partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | phonix | Return the Phonix code for a word.
This is a wrapper for :py:meth:`Phonix.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the end of the return value with 0s to achieve ... | abydos/phonetic/_phonix.py | def phonix(word, max_length=4, zero_pad=True):
"""Return the Phonix code for a word.
This is a wrapper for :py:meth:`Phonix.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
... | def phonix(word, max_length=4, zero_pad=True):
"""Return the Phonix code for a word.
This is a wrapper for :py:meth:`Phonix.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
... | [
"Return",
"the",
"Phonix",
"code",
"for",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_phonix.py#L370-L401 | [
"def",
"phonix",
"(",
"word",
",",
"max_length",
"=",
"4",
",",
"zero_pad",
"=",
"True",
")",
":",
"return",
"Phonix",
"(",
")",
".",
"encode",
"(",
"word",
",",
"max_length",
",",
"zero_pad",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Phonix.encode | Return the Phonix code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the end of the return value with 0s to achieve a max_length
... | abydos/phonetic/_phonix.py | def encode(self, word, max_length=4, zero_pad=True):
"""Return the Phonix code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the ... | def encode(self, word, max_length=4, zero_pad=True):
"""Return the Phonix code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the ... | [
"Return",
"the",
"Phonix",
"code",
"for",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_phonix.py#L182-L367 | [
"def",
"encode",
"(",
"self",
",",
"word",
",",
"max_length",
"=",
"4",
",",
"zero_pad",
"=",
"True",
")",
":",
"def",
"_start_repl",
"(",
"word",
",",
"src",
",",
"tar",
",",
"post",
"=",
"None",
")",
":",
"\"\"\"Replace src with tar at the start of word.... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | editex | Return the Editex distance between two strings.
This is a wrapper for :py:meth:`Editex.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A 3-tuple representing the cost of the four possible edits:... | abydos/distance/_editex.py | def editex(src, tar, cost=(0, 1, 2), local=False):
"""Return the Editex distance between two strings.
This is a wrapper for :py:meth:`Editex.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A... | def editex(src, tar, cost=(0, 1, 2), local=False):
"""Return the Editex distance between two strings.
This is a wrapper for :py:meth:`Editex.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A... | [
"Return",
"the",
"Editex",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_editex.py#L229-L263 | [
"def",
"editex",
"(",
"src",
",",
"tar",
",",
"cost",
"=",
"(",
"0",
",",
"1",
",",
"2",
")",
",",
"local",
"=",
"False",
")",
":",
"return",
"Editex",
"(",
")",
".",
"dist_abs",
"(",
"src",
",",
"tar",
",",
"cost",
",",
"local",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | dist_editex | Return the normalized Editex distance between two strings.
This is a wrapper for :py:meth:`Editex.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A 3-tuple representing the cost of the four possible... | abydos/distance/_editex.py | def dist_editex(src, tar, cost=(0, 1, 2), local=False):
"""Return the normalized Editex distance between two strings.
This is a wrapper for :py:meth:`Editex.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tup... | def dist_editex(src, tar, cost=(0, 1, 2), local=False):
"""Return the normalized Editex distance between two strings.
This is a wrapper for :py:meth:`Editex.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tup... | [
"Return",
"the",
"normalized",
"Editex",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_editex.py#L266-L300 | [
"def",
"dist_editex",
"(",
"src",
",",
"tar",
",",
"cost",
"=",
"(",
"0",
",",
"1",
",",
"2",
")",
",",
"local",
"=",
"False",
")",
":",
"return",
"Editex",
"(",
")",
".",
"dist",
"(",
"src",
",",
"tar",
",",
"cost",
",",
"local",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | sim_editex | Return the normalized Editex similarity of two strings.
This is a wrapper for :py:meth:`Editex.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A 3-tuple representing the cost of the four possible edi... | abydos/distance/_editex.py | def sim_editex(src, tar, cost=(0, 1, 2), local=False):
"""Return the normalized Editex similarity of two strings.
This is a wrapper for :py:meth:`Editex.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
... | def sim_editex(src, tar, cost=(0, 1, 2), local=False):
"""Return the normalized Editex similarity of two strings.
This is a wrapper for :py:meth:`Editex.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
... | [
"Return",
"the",
"normalized",
"Editex",
"similarity",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_editex.py#L303-L337 | [
"def",
"sim_editex",
"(",
"src",
",",
"tar",
",",
"cost",
"=",
"(",
"0",
",",
"1",
",",
"2",
")",
",",
"local",
"=",
"False",
")",
":",
"return",
"Editex",
"(",
")",
".",
"sim",
"(",
"src",
",",
"tar",
",",
"cost",
",",
"local",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Editex.dist_abs | Return the Editex distance between two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A 3-tuple representing the cost of the four possible edits: match,
sam... | abydos/distance/_editex.py | def dist_abs(self, src, tar, cost=(0, 1, 2), local=False):
"""Return the Editex distance between two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A 3-tuple re... | def dist_abs(self, src, tar, cost=(0, 1, 2), local=False):
"""Return the Editex distance between two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A 3-tuple re... | [
"Return",
"the",
"Editex",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_editex.py#L66-L179 | [
"def",
"dist_abs",
"(",
"self",
",",
"src",
",",
"tar",
",",
"cost",
"=",
"(",
"0",
",",
"1",
",",
"2",
")",
",",
"local",
"=",
"False",
")",
":",
"match_cost",
",",
"group_cost",
",",
"mismatch_cost",
"=",
"cost",
"def",
"r_cost",
"(",
"ch1",
",... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Editex.dist | Return the normalized Editex distance between two strings.
The Editex distance is normalized by dividing the Editex distance
(calculated by any of the three supported methods) by the greater of
the number of characters in src times the cost of a delete and
the number of characters in ta... | abydos/distance/_editex.py | def dist(self, src, tar, cost=(0, 1, 2), local=False):
"""Return the normalized Editex distance between two strings.
The Editex distance is normalized by dividing the Editex distance
(calculated by any of the three supported methods) by the greater of
the number of characters in src tim... | def dist(self, src, tar, cost=(0, 1, 2), local=False):
"""Return the normalized Editex distance between two strings.
The Editex distance is normalized by dividing the Editex distance
(calculated by any of the three supported methods) by the greater of
the number of characters in src tim... | [
"Return",
"the",
"normalized",
"Editex",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_editex.py#L181-L226 | [
"def",
"dist",
"(",
"self",
",",
"src",
",",
"tar",
",",
"cost",
"=",
"(",
"0",
",",
"1",
",",
"2",
")",
",",
"local",
"=",
"False",
")",
":",
"if",
"src",
"==",
"tar",
":",
"return",
"0.0",
"mismatch_cost",
"=",
"cost",
"[",
"2",
"]",
"retur... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | position_fingerprint | Return the position fingerprint.
This is a wrapper for :py:meth:`Position.fingerprint`.
Parameters
----------
word : str
The word to fingerprint
n_bits : int
Number of bits in the fingerprint returned
most_common : list
The most common tokens in the target language, ord... | abydos/fingerprint/_position.py | def position_fingerprint(
word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG, bits_per_letter=3
):
"""Return the position fingerprint.
This is a wrapper for :py:meth:`Position.fingerprint`.
Parameters
----------
word : str
The word to fingerprint
n_bits : int
Number of bit... | def position_fingerprint(
word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG, bits_per_letter=3
):
"""Return the position fingerprint.
This is a wrapper for :py:meth:`Position.fingerprint`.
Parameters
----------
word : str
The word to fingerprint
n_bits : int
Number of bit... | [
"Return",
"the",
"position",
"fingerprint",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_position.py#L108-L145 | [
"def",
"position_fingerprint",
"(",
"word",
",",
"n_bits",
"=",
"16",
",",
"most_common",
"=",
"MOST_COMMON_LETTERS_CG",
",",
"bits_per_letter",
"=",
"3",
")",
":",
"return",
"Position",
"(",
")",
".",
"fingerprint",
"(",
"word",
",",
"n_bits",
",",
"most_co... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Position.fingerprint | Return the position fingerprint.
Parameters
----------
word : str
The word to fingerprint
n_bits : int
Number of bits in the fingerprint returned
most_common : list
The most common tokens in the target language, ordered by frequency
bi... | abydos/fingerprint/_position.py | def fingerprint(
self,
word,
n_bits=16,
most_common=MOST_COMMON_LETTERS_CG,
bits_per_letter=3,
):
"""Return the position fingerprint.
Parameters
----------
word : str
The word to fingerprint
n_bits : int
Number ... | def fingerprint(
self,
word,
n_bits=16,
most_common=MOST_COMMON_LETTERS_CG,
bits_per_letter=3,
):
"""Return the position fingerprint.
Parameters
----------
word : str
The word to fingerprint
n_bits : int
Number ... | [
"Return",
"the",
"position",
"fingerprint",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_position.py#L42-L105 | [
"def",
"fingerprint",
"(",
"self",
",",
"word",
",",
"n_bits",
"=",
"16",
",",
"most_common",
"=",
"MOST_COMMON_LETTERS_CG",
",",
"bits_per_letter",
"=",
"3",
",",
")",
":",
"position",
"=",
"{",
"}",
"for",
"pos",
",",
"letter",
"in",
"enumerate",
"(",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Caumanns.stem | Return Caumanns German stem.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = Caumanns()
>>> stmr.stem('lesen')
'les'
>>> stmr.stem('grau... | abydos/stemmer/_caumanns.py | def stem(self, word):
"""Return Caumanns German stem.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = Caumanns()
>>> stmr.stem('lesen')
... | def stem(self, word):
"""Return Caumanns German stem.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = Caumanns()
>>> stmr.stem('lesen')
... | [
"Return",
"Caumanns",
"German",
"stem",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_caumanns.py#L53-L146 | [
"def",
"stem",
"(",
"self",
",",
"word",
")",
":",
"if",
"not",
"word",
":",
"return",
"''",
"upper_initial",
"=",
"word",
"[",
"0",
"]",
".",
"isupper",
"(",
")",
"word",
"=",
"normalize",
"(",
"'NFC'",
",",
"text_type",
"(",
"word",
".",
"lower",... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | NCDarith.dist | Return the NCD between two strings using arithmetic coding.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
probs : dict
A dictionary trained with :py:meth:`Arithmetic.train`
Returns... | abydos/distance/_ncd_arith.py | def dist(self, src, tar, probs=None):
"""Return the NCD between two strings using arithmetic coding.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
probs : dict
A dictionary trained ... | def dist(self, src, tar, probs=None):
"""Return the NCD between two strings using arithmetic coding.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
probs : dict
A dictionary trained ... | [
"Return",
"the",
"NCD",
"between",
"two",
"strings",
"using",
"arithmetic",
"coding",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_ncd_arith.py#L51-L97 | [
"def",
"dist",
"(",
"self",
",",
"src",
",",
"tar",
",",
"probs",
"=",
"None",
")",
":",
"if",
"src",
"==",
"tar",
":",
"return",
"0.0",
"if",
"probs",
"is",
"None",
":",
"# lacking a reasonable dictionary, train on the strings themselves",
"self",
".",
"_co... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | readfile | Read fn and return the contents.
Parameters
----------
fn : str
A filename
Returns
-------
str
The content of the file | setup.py | def readfile(fn):
"""Read fn and return the contents.
Parameters
----------
fn : str
A filename
Returns
-------
str
The content of the file
"""
with open(path.join(HERE, fn), 'r', encoding='utf-8') as f:
return f.read() | def readfile(fn):
"""Read fn and return the contents.
Parameters
----------
fn : str
A filename
Returns
-------
str
The content of the file
"""
with open(path.join(HERE, fn), 'r', encoding='utf-8') as f:
return f.read() | [
"Read",
"fn",
"and",
"return",
"the",
"contents",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/setup.py#L41-L56 | [
"def",
"readfile",
"(",
"fn",
")",
":",
"with",
"open",
"(",
"path",
".",
"join",
"(",
"HERE",
",",
"fn",
")",
",",
"'r'",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"f",
":",
"return",
"f",
".",
"read",
"(",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | spanish_metaphone | Return the Spanish Metaphone of a word.
This is a wrapper for :py:meth:`SpanishMetaphone.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 6)
modified : bool
Set to True to use del Pilar Angeles... | abydos/phonetic/_spanish_metaphone.py | def spanish_metaphone(word, max_length=6, modified=False):
"""Return the Spanish Metaphone of a word.
This is a wrapper for :py:meth:`SpanishMetaphone.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 6... | def spanish_metaphone(word, max_length=6, modified=False):
"""Return the Spanish Metaphone of a word.
This is a wrapper for :py:meth:`SpanishMetaphone.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 6... | [
"Return",
"the",
"Spanish",
"Metaphone",
"of",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_spanish_metaphone.py#L235-L269 | [
"def",
"spanish_metaphone",
"(",
"word",
",",
"max_length",
"=",
"6",
",",
"modified",
"=",
"False",
")",
":",
"return",
"SpanishMetaphone",
"(",
")",
".",
"encode",
"(",
"word",
",",
"max_length",
",",
"modified",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | SpanishMetaphone.encode | Return the Spanish Metaphone of a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 6)
modified : bool
Set to True to use del Pilar Angeles & Bailón-Miguel's modified
... | abydos/phonetic/_spanish_metaphone.py | def encode(self, word, max_length=6, modified=False):
"""Return the Spanish Metaphone of a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 6)
modified : bool
Se... | def encode(self, word, max_length=6, modified=False):
"""Return the Spanish Metaphone of a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 6)
modified : bool
Se... | [
"Return",
"the",
"Spanish",
"Metaphone",
"of",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_spanish_metaphone.py#L50-L232 | [
"def",
"encode",
"(",
"self",
",",
"word",
",",
"max_length",
"=",
"6",
",",
"modified",
"=",
"False",
")",
":",
"def",
"_is_vowel",
"(",
"pos",
")",
":",
"\"\"\"Return True if the character at word[pos] is a vowel.\n\n Parameters\n ----------\n ... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | FONEM.encode | Return the FONEM code of a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The FONEM code
Examples
--------
>>> pe = FONEM()
>>> pe.encode('Marchand')
'MARCHEN'
>>>... | abydos/phonetic/_fonem.py | def encode(self, word):
"""Return the FONEM code of a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The FONEM code
Examples
--------
>>> pe = FONEM()
>>> pe.encode('March... | def encode(self, word):
"""Return the FONEM code of a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The FONEM code
Examples
--------
>>> pe = FONEM()
>>> pe.encode('March... | [
"Return",
"the",
"FONEM",
"code",
"of",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_fonem.py#L201-L241 | [
"def",
"encode",
"(",
"self",
",",
"word",
")",
":",
"# normalize, upper-case, and filter non-French letters",
"word",
"=",
"unicode_normalize",
"(",
"'NFKD'",
",",
"text_type",
"(",
"word",
".",
"upper",
"(",
")",
")",
")",
"word",
"=",
"word",
".",
"translat... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | StatisticsCanada.encode | Return the Statistics Canada code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The maximum length (default 4) of the code to return
Returns
-------
str
The Statistics Canada name code val... | abydos/phonetic/_statistics_canada.py | def encode(self, word, max_length=4):
"""Return the Statistics Canada code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The maximum length (default 4) of the code to return
Returns
-------
st... | def encode(self, word, max_length=4):
"""Return the Statistics Canada code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The maximum length (default 4) of the code to return
Returns
-------
st... | [
"Return",
"the",
"Statistics",
"Canada",
"code",
"for",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_statistics_canada.py#L53-L95 | [
"def",
"encode",
"(",
"self",
",",
"word",
",",
"max_length",
"=",
"4",
")",
":",
"# uppercase, normalize, decompose, and filter non-A-Z out",
"word",
"=",
"unicode_normalize",
"(",
"'NFKD'",
",",
"text_type",
"(",
"word",
".",
"upper",
"(",
")",
")",
")",
"wo... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | synoname | Return the Synoname similarity type of two words.
This is a wrapper for :py:meth:`Synoname.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
word_approx_min : float
The minimum word approximation value to sign... | abydos/distance/_synoname.py | def synoname(
src,
tar,
word_approx_min=0.3,
char_approx_min=0.73,
tests=2 ** 12 - 1,
ret_name=False,
):
"""Return the Synoname similarity type of two words.
This is a wrapper for :py:meth:`Synoname.dist_abs`.
Parameters
----------
src : str
Source string for compar... | def synoname(
src,
tar,
word_approx_min=0.3,
char_approx_min=0.73,
tests=2 ** 12 - 1,
ret_name=False,
):
"""Return the Synoname similarity type of two words.
This is a wrapper for :py:meth:`Synoname.dist_abs`.
Parameters
----------
src : str
Source string for compar... | [
"Return",
"the",
"Synoname",
"similarity",
"type",
"of",
"two",
"words",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_synoname.py#L751-L802 | [
"def",
"synoname",
"(",
"src",
",",
"tar",
",",
"word_approx_min",
"=",
"0.3",
",",
"char_approx_min",
"=",
"0.73",
",",
"tests",
"=",
"2",
"**",
"12",
"-",
"1",
",",
"ret_name",
"=",
"False",
",",
")",
":",
"return",
"Synoname",
"(",
")",
".",
"di... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Synoname._synoname_strip_punct | Return a word with punctuation stripped out.
Parameters
----------
word : str
A word to strip punctuation from
Returns
-------
str
The word stripped of punctuation
Examples
--------
>>> pe = Synoname()
>>> pe._syn... | abydos/distance/_synoname.py | def _synoname_strip_punct(self, word):
"""Return a word with punctuation stripped out.
Parameters
----------
word : str
A word to strip punctuation from
Returns
-------
str
The word stripped of punctuation
Examples
------... | def _synoname_strip_punct(self, word):
"""Return a word with punctuation stripped out.
Parameters
----------
word : str
A word to strip punctuation from
Returns
-------
str
The word stripped of punctuation
Examples
------... | [
"Return",
"a",
"word",
"with",
"punctuation",
"stripped",
"out",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_synoname.py#L88-L112 | [
"def",
"_synoname_strip_punct",
"(",
"self",
",",
"word",
")",
":",
"stripped",
"=",
"''",
"for",
"char",
"in",
"word",
":",
"if",
"char",
"not",
"in",
"set",
"(",
"',-./:;\"&\\'()!{|}?$%*+<=>[\\\\]^_`~'",
")",
":",
"stripped",
"+=",
"char",
"return",
"strip... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Synoname._synoname_word_approximation | Return the Synoname word approximation score for two names.
Parameters
----------
src_ln : str
Last name of the source
tar_ln : str
Last name of the target
src_fn : str
First name of the source (optional)
tar_fn : str
First... | abydos/distance/_synoname.py | def _synoname_word_approximation(
self, src_ln, tar_ln, src_fn='', tar_fn='', features=None
):
"""Return the Synoname word approximation score for two names.
Parameters
----------
src_ln : str
Last name of the source
tar_ln : str
Last name of ... | def _synoname_word_approximation(
self, src_ln, tar_ln, src_fn='', tar_fn='', features=None
):
"""Return the Synoname word approximation score for two names.
Parameters
----------
src_ln : str
Last name of the source
tar_ln : str
Last name of ... | [
"Return",
"the",
"Synoname",
"word",
"approximation",
"score",
"for",
"two",
"names",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_synoname.py#L114-L423 | [
"def",
"_synoname_word_approximation",
"(",
"self",
",",
"src_ln",
",",
"tar_ln",
",",
"src_fn",
"=",
"''",
",",
"tar_fn",
"=",
"''",
",",
"features",
"=",
"None",
")",
":",
"if",
"features",
"is",
"None",
":",
"features",
"=",
"{",
"}",
"if",
"'src_sp... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Synoname.dist_abs | Return the Synoname similarity type of two words.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
word_approx_min : float
The minimum word approximation value to signal a 'word_approx'
... | abydos/distance/_synoname.py | def dist_abs(
self,
src,
tar,
word_approx_min=0.3,
char_approx_min=0.73,
tests=2 ** 12 - 1,
ret_name=False,
):
"""Return the Synoname similarity type of two words.
Parameters
----------
src : str
Source string for c... | def dist_abs(
self,
src,
tar,
word_approx_min=0.3,
char_approx_min=0.73,
tests=2 ** 12 - 1,
ret_name=False,
):
"""Return the Synoname similarity type of two words.
Parameters
----------
src : str
Source string for c... | [
"Return",
"the",
"Synoname",
"similarity",
"type",
"of",
"two",
"words",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_synoname.py#L425-L711 | [
"def",
"dist_abs",
"(",
"self",
",",
"src",
",",
"tar",
",",
"word_approx_min",
"=",
"0.3",
",",
"char_approx_min",
"=",
"0.73",
",",
"tests",
"=",
"2",
"**",
"12",
"-",
"1",
",",
"ret_name",
"=",
"False",
",",
")",
":",
"if",
"isinstance",
"(",
"t... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Synoname.dist | Return the normalized Synoname distance between two words.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
word_approx_min : float
The minimum word approximation value to signal a 'word_appro... | abydos/distance/_synoname.py | def dist(
self,
src,
tar,
word_approx_min=0.3,
char_approx_min=0.73,
tests=2 ** 12 - 1,
):
"""Return the normalized Synoname distance between two words.
Parameters
----------
src : str
Source string for comparison
t... | def dist(
self,
src,
tar,
word_approx_min=0.3,
char_approx_min=0.73,
tests=2 ** 12 - 1,
):
"""Return the normalized Synoname distance between two words.
Parameters
----------
src : str
Source string for comparison
t... | [
"Return",
"the",
"normalized",
"Synoname",
"distance",
"between",
"two",
"words",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_synoname.py#L713-L748 | [
"def",
"dist",
"(",
"self",
",",
"src",
",",
"tar",
",",
"word_approx_min",
"=",
"0.3",
",",
"char_approx_min",
"=",
"0.73",
",",
"tests",
"=",
"2",
"**",
"12",
"-",
"1",
",",
")",
":",
"return",
"(",
"synoname",
"(",
"src",
",",
"tar",
",",
"wor... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Jaccard.sim | r"""Return the Jaccard similarity of two strings.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target string (or QGrams/Counter objects) for comparison
qval : int
The length of each q-gram;... | abydos/distance/_jaccard.py | def sim(self, src, tar, qval=2):
r"""Return the Jaccard similarity of two strings.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target string (or QGrams/Counter objects) for comparison
qval : i... | def sim(self, src, tar, qval=2):
r"""Return the Jaccard similarity of two strings.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target string (or QGrams/Counter objects) for comparison
qval : i... | [
"r",
"Return",
"the",
"Jaccard",
"similarity",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_jaccard.py#L51-L81 | [
"def",
"sim",
"(",
"self",
",",
"src",
",",
"tar",
",",
"qval",
"=",
"2",
")",
":",
"return",
"super",
"(",
"self",
".",
"__class__",
",",
"self",
")",
".",
"sim",
"(",
"src",
",",
"tar",
",",
"qval",
",",
"1",
",",
"1",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Jaccard.tanimoto_coeff | Return the Tanimoto distance between two strings.
Tanimoto distance :cite:`Tanimoto:1958` is
:math:`-log_{2} sim_{Tanimoto}(X, Y)`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target string (... | abydos/distance/_jaccard.py | def tanimoto_coeff(self, src, tar, qval=2):
"""Return the Tanimoto distance between two strings.
Tanimoto distance :cite:`Tanimoto:1958` is
:math:`-log_{2} sim_{Tanimoto}(X, Y)`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for c... | def tanimoto_coeff(self, src, tar, qval=2):
"""Return the Tanimoto distance between two strings.
Tanimoto distance :cite:`Tanimoto:1958` is
:math:`-log_{2} sim_{Tanimoto}(X, Y)`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for c... | [
"Return",
"the",
"Tanimoto",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_jaccard.py#L83-L120 | [
"def",
"tanimoto_coeff",
"(",
"self",
",",
"src",
",",
"tar",
",",
"qval",
"=",
"2",
")",
":",
"coeff",
"=",
"self",
".",
"sim",
"(",
"src",
",",
"tar",
",",
"qval",
")",
"if",
"coeff",
"!=",
"0",
":",
"return",
"log",
"(",
"coeff",
",",
"2",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | sift4_common | Return the "common" Sift4 distance between two terms.
This is a wrapper for :py:meth:`Sift4.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset : int
The number of characters to search for matching le... | abydos/distance/_sift4.py | def sift4_common(src, tar, max_offset=5, max_distance=0):
"""Return the "common" Sift4 distance between two terms.
This is a wrapper for :py:meth:`Sift4.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset... | def sift4_common(src, tar, max_offset=5, max_distance=0):
"""Return the "common" Sift4 distance between two terms.
This is a wrapper for :py:meth:`Sift4.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset... | [
"Return",
"the",
"common",
"Sift4",
"distance",
"between",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_sift4.py#L196-L229 | [
"def",
"sift4_common",
"(",
"src",
",",
"tar",
",",
"max_offset",
"=",
"5",
",",
"max_distance",
"=",
"0",
")",
":",
"return",
"Sift4",
"(",
")",
".",
"dist_abs",
"(",
"src",
",",
"tar",
",",
"max_offset",
",",
"max_distance",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | dist_sift4 | Return the normalized "common" Sift4 distance between two terms.
This is a wrapper for :py:meth:`Sift4.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset : int
The number of characters to search for matc... | abydos/distance/_sift4.py | def dist_sift4(src, tar, max_offset=5, max_distance=0):
"""Return the normalized "common" Sift4 distance between two terms.
This is a wrapper for :py:meth:`Sift4.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_o... | def dist_sift4(src, tar, max_offset=5, max_distance=0):
"""Return the normalized "common" Sift4 distance between two terms.
This is a wrapper for :py:meth:`Sift4.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_o... | [
"Return",
"the",
"normalized",
"common",
"Sift4",
"distance",
"between",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_sift4.py#L232-L265 | [
"def",
"dist_sift4",
"(",
"src",
",",
"tar",
",",
"max_offset",
"=",
"5",
",",
"max_distance",
"=",
"0",
")",
":",
"return",
"Sift4",
"(",
")",
".",
"dist",
"(",
"src",
",",
"tar",
",",
"max_offset",
",",
"max_distance",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | sim_sift4 | Return the normalized "common" Sift4 similarity of two terms.
This is a wrapper for :py:meth:`Sift4.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset : int
The number of characters to search for matching... | abydos/distance/_sift4.py | def sim_sift4(src, tar, max_offset=5, max_distance=0):
"""Return the normalized "common" Sift4 similarity of two terms.
This is a wrapper for :py:meth:`Sift4.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset... | def sim_sift4(src, tar, max_offset=5, max_distance=0):
"""Return the normalized "common" Sift4 similarity of two terms.
This is a wrapper for :py:meth:`Sift4.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset... | [
"Return",
"the",
"normalized",
"common",
"Sift4",
"similarity",
"of",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_sift4.py#L268-L301 | [
"def",
"sim_sift4",
"(",
"src",
",",
"tar",
",",
"max_offset",
"=",
"5",
",",
"max_distance",
"=",
"0",
")",
":",
"return",
"Sift4",
"(",
")",
".",
"sim",
"(",
"src",
",",
"tar",
",",
"max_offset",
",",
"max_distance",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Sift4.dist_abs | Return the "common" Sift4 distance between two terms.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset : int
The number of characters to search for matching letters
max_dist... | abydos/distance/_sift4.py | def dist_abs(self, src, tar, max_offset=5, max_distance=0):
"""Return the "common" Sift4 distance between two terms.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset : int
T... | def dist_abs(self, src, tar, max_offset=5, max_distance=0):
"""Return the "common" Sift4 distance between two terms.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset : int
T... | [
"Return",
"the",
"common",
"Sift4",
"distance",
"between",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_sift4.py#L45-L155 | [
"def",
"dist_abs",
"(",
"self",
",",
"src",
",",
"tar",
",",
"max_offset",
"=",
"5",
",",
"max_distance",
"=",
"0",
")",
":",
"if",
"not",
"src",
":",
"return",
"len",
"(",
"tar",
")",
"if",
"not",
"tar",
":",
"return",
"len",
"(",
"src",
")",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Sift4.dist | Return the normalized "common" Sift4 distance between two terms.
This is Sift4 distance, normalized to [0, 1].
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
max_offset : int
The nu... | abydos/distance/_sift4.py | def dist(self, src, tar, max_offset=5, max_distance=0):
"""Return the normalized "common" Sift4 distance between two terms.
This is Sift4 distance, normalized to [0, 1].
Parameters
----------
src : str
Source string for comparison
tar : str
Targe... | def dist(self, src, tar, max_offset=5, max_distance=0):
"""Return the normalized "common" Sift4 distance between two terms.
This is Sift4 distance, normalized to [0, 1].
Parameters
----------
src : str
Source string for comparison
tar : str
Targe... | [
"Return",
"the",
"normalized",
"common",
"Sift4",
"distance",
"between",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_sift4.py#L157-L193 | [
"def",
"dist",
"(",
"self",
",",
"src",
",",
"tar",
",",
"max_offset",
"=",
"5",
",",
"max_distance",
"=",
"0",
")",
":",
"return",
"self",
".",
"dist_abs",
"(",
"src",
",",
"tar",
",",
"max_offset",
",",
"max_distance",
")",
"/",
"(",
"max",
"(",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | NCDbz2.dist | Return the NCD between two strings using bzip2 compression.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Compression distance
Examples
... | abydos/distance/_ncd_bz2.py | def dist(self, src, tar):
"""Return the NCD between two strings using bzip2 compression.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Compres... | def dist(self, src, tar):
"""Return the NCD between two strings using bzip2 compression.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Compres... | [
"Return",
"the",
"NCD",
"between",
"two",
"strings",
"using",
"bzip2",
"compression",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_ncd_bz2.py#L59-L101 | [
"def",
"dist",
"(",
"self",
",",
"src",
",",
"tar",
")",
":",
"if",
"src",
"==",
"tar",
":",
"return",
"0.0",
"src",
"=",
"src",
".",
"encode",
"(",
"'utf-8'",
")",
"tar",
"=",
"tar",
".",
"encode",
"(",
"'utf-8'",
")",
"src_comp",
"=",
"bz2",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | MetaSoundex.encode | Return the MetaSoundex code for a word.
Parameters
----------
word : str
The word to transform
lang : str
Either ``en`` for English or ``es`` for Spanish
Returns
-------
str
The MetaSoundex code
Examples
-----... | abydos/phonetic/_meta_soundex.py | def encode(self, word, lang='en'):
"""Return the MetaSoundex code for a word.
Parameters
----------
word : str
The word to transform
lang : str
Either ``en`` for English or ``es`` for Spanish
Returns
-------
str
The Me... | def encode(self, word, lang='en'):
"""Return the MetaSoundex code for a word.
Parameters
----------
word : str
The word to transform
lang : str
Either ``en`` for English or ``es`` for Spanish
Returns
-------
str
The Me... | [
"Return",
"the",
"MetaSoundex",
"code",
"for",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_meta_soundex.py#L58-L105 | [
"def",
"encode",
"(",
"self",
",",
"word",
",",
"lang",
"=",
"'en'",
")",
":",
"if",
"lang",
"==",
"'es'",
":",
"return",
"self",
".",
"_phonetic_spanish",
".",
"encode",
"(",
"self",
".",
"_spanish_metaphone",
".",
"encode",
"(",
"word",
")",
")",
"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | SStemmer.stem | Return the S-stemmed form of a word.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = SStemmer()
>>> stmr.stem('summaries')
'summary'
>>>... | abydos/stemmer/_s_stemmer.py | def stem(self, word):
"""Return the S-stemmed form of a word.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = SStemmer()
>>> stmr.stem('summarie... | def stem(self, word):
"""Return the S-stemmed form of a word.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = SStemmer()
>>> stmr.stem('summarie... | [
"Return",
"the",
"S",
"-",
"stemmed",
"form",
"of",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_s_stemmer.py#L42-L77 | [
"def",
"stem",
"(",
"self",
",",
"word",
")",
":",
"lowered",
"=",
"word",
".",
"lower",
"(",
")",
"if",
"lowered",
"[",
"-",
"3",
":",
"]",
"==",
"'ies'",
"and",
"lowered",
"[",
"-",
"4",
":",
"-",
"3",
"]",
"not",
"in",
"{",
"'e'",
",",
"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | RatcliffObershelp.sim | Return the Ratcliff-Obershelp similarity of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Ratcliff-Obershelp similarity
Examples... | abydos/distance/_ratcliff_obershelp.py | def sim(self, src, tar):
"""Return the Ratcliff-Obershelp similarity of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Ratcliff-Ob... | def sim(self, src, tar):
"""Return the Ratcliff-Obershelp similarity of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Ratcliff-Ob... | [
"Return",
"the",
"Ratcliff",
"-",
"Obershelp",
"similarity",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_ratcliff_obershelp.py#L63-L165 | [
"def",
"sim",
"(",
"self",
",",
"src",
",",
"tar",
")",
":",
"def",
"_lcsstr_stl",
"(",
"src",
",",
"tar",
")",
":",
"\"\"\"Return start positions & length for Ratcliff-Obershelp.\n\n Parameters\n ----------\n src : str\n Source str... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | refined_soundex | Return the Refined Soundex code for a word.
This is a wrapper for :py:meth:`RefinedSoundex.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to unlimited)
zero_pad : bool
Pad the end of the return ... | abydos/phonetic/_refined_soundex.py | def refined_soundex(word, max_length=-1, zero_pad=False, retain_vowels=False):
"""Return the Refined Soundex code for a word.
This is a wrapper for :py:meth:`RefinedSoundex.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code r... | def refined_soundex(word, max_length=-1, zero_pad=False, retain_vowels=False):
"""Return the Refined Soundex code for a word.
This is a wrapper for :py:meth:`RefinedSoundex.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code r... | [
"Return",
"the",
"Refined",
"Soundex",
"code",
"for",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_refined_soundex.py#L106-L139 | [
"def",
"refined_soundex",
"(",
"word",
",",
"max_length",
"=",
"-",
"1",
",",
"zero_pad",
"=",
"False",
",",
"retain_vowels",
"=",
"False",
")",
":",
"return",
"RefinedSoundex",
"(",
")",
".",
"encode",
"(",
"word",
",",
"max_length",
",",
"zero_pad",
",... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | RefinedSoundex.encode | Return the Refined Soundex code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to unlimited)
zero_pad : bool
Pad the end of the return value with 0s to achieve a ma... | abydos/phonetic/_refined_soundex.py | def encode(self, word, max_length=-1, zero_pad=False, retain_vowels=False):
"""Return the Refined Soundex code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to unlimited)
... | def encode(self, word, max_length=-1, zero_pad=False, retain_vowels=False):
"""Return the Refined Soundex code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to unlimited)
... | [
"Return",
"the",
"Refined",
"Soundex",
"code",
"for",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_refined_soundex.py#L54-L103 | [
"def",
"encode",
"(",
"self",
",",
"word",
",",
"max_length",
"=",
"-",
"1",
",",
"zero_pad",
"=",
"False",
",",
"retain_vowels",
"=",
"False",
")",
":",
"# uppercase, normalize, decompose, and filter non-A-Z out",
"word",
"=",
"unicode_normalize",
"(",
"'NFKD'",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | MRA.dist_abs | Return the MRA comparison rating of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
int
MRA comparison rating
Examples
--------
... | abydos/distance/_mra.py | def dist_abs(self, src, tar):
"""Return the MRA comparison rating of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
int
MRA comparison r... | def dist_abs(self, src, tar):
"""Return the MRA comparison rating of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
int
MRA comparison r... | [
"Return",
"the",
"MRA",
"comparison",
"rating",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_mra.py#L46-L111 | [
"def",
"dist_abs",
"(",
"self",
",",
"src",
",",
"tar",
")",
":",
"if",
"src",
"==",
"tar",
":",
"return",
"6",
"if",
"src",
"==",
"''",
"or",
"tar",
"==",
"''",
":",
"return",
"0",
"src",
"=",
"list",
"(",
"mra",
"(",
"src",
")",
")",
"tar",... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | ParmarKumbharana.encode | Return the Parmar-Kumbharana encoding of a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The Parmar-Kumbharana encoding
Examples
--------
>>> pe = ParmarKumbharana()
>>> pe.encod... | abydos/phonetic/_parmar_kumbharana.py | def encode(self, word):
"""Return the Parmar-Kumbharana encoding of a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The Parmar-Kumbharana encoding
Examples
--------
>>> pe = Parm... | def encode(self, word):
"""Return the Parmar-Kumbharana encoding of a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The Parmar-Kumbharana encoding
Examples
--------
>>> pe = Parm... | [
"Return",
"the",
"Parmar",
"-",
"Kumbharana",
"encoding",
"of",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_parmar_kumbharana.py#L64-L108 | [
"def",
"encode",
"(",
"self",
",",
"word",
")",
":",
"word",
"=",
"word",
".",
"upper",
"(",
")",
"# Rule 3",
"word",
"=",
"self",
".",
"_delete_consecutive_repeats",
"(",
"word",
")",
"# Rule 4",
"# Rule 5",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | eudex_hamming | Calculate the Hamming distance between the Eudex hashes of two terms.
This is a wrapper for :py:meth:`Eudex.eudex_hamming`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
weights : str, iterable, or generator function
... | abydos/distance/_eudex.py | def eudex_hamming(
src, tar, weights='exponential', max_length=8, normalized=False
):
"""Calculate the Hamming distance between the Eudex hashes of two terms.
This is a wrapper for :py:meth:`Eudex.eudex_hamming`.
Parameters
----------
src : str
Source string for comparison
tar : st... | def eudex_hamming(
src, tar, weights='exponential', max_length=8, normalized=False
):
"""Calculate the Hamming distance between the Eudex hashes of two terms.
This is a wrapper for :py:meth:`Eudex.eudex_hamming`.
Parameters
----------
src : str
Source string for comparison
tar : st... | [
"Calculate",
"the",
"Hamming",
"distance",
"between",
"the",
"Eudex",
"hashes",
"of",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_eudex.py#L239-L304 | [
"def",
"eudex_hamming",
"(",
"src",
",",
"tar",
",",
"weights",
"=",
"'exponential'",
",",
"max_length",
"=",
"8",
",",
"normalized",
"=",
"False",
")",
":",
"return",
"Eudex",
"(",
")",
".",
"dist_abs",
"(",
"src",
",",
"tar",
",",
"weights",
",",
"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | dist_eudex | Return normalized Hamming distance between Eudex hashes of two terms.
This is a wrapper for :py:meth:`Eudex.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
weights : str, iterable, or generator function
The weig... | abydos/distance/_eudex.py | def dist_eudex(src, tar, weights='exponential', max_length=8):
"""Return normalized Hamming distance between Eudex hashes of two terms.
This is a wrapper for :py:meth:`Eudex.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparis... | def dist_eudex(src, tar, weights='exponential', max_length=8):
"""Return normalized Hamming distance between Eudex hashes of two terms.
This is a wrapper for :py:meth:`Eudex.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparis... | [
"Return",
"normalized",
"Hamming",
"distance",
"between",
"Eudex",
"hashes",
"of",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_eudex.py#L307-L340 | [
"def",
"dist_eudex",
"(",
"src",
",",
"tar",
",",
"weights",
"=",
"'exponential'",
",",
"max_length",
"=",
"8",
")",
":",
"return",
"Eudex",
"(",
")",
".",
"dist",
"(",
"src",
",",
"tar",
",",
"weights",
",",
"max_length",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | sim_eudex | Return normalized Hamming similarity between Eudex hashes of two terms.
This is a wrapper for :py:meth:`Eudex.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
weights : str, iterable, or generator function
The wei... | abydos/distance/_eudex.py | def sim_eudex(src, tar, weights='exponential', max_length=8):
"""Return normalized Hamming similarity between Eudex hashes of two terms.
This is a wrapper for :py:meth:`Eudex.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparis... | def sim_eudex(src, tar, weights='exponential', max_length=8):
"""Return normalized Hamming similarity between Eudex hashes of two terms.
This is a wrapper for :py:meth:`Eudex.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparis... | [
"Return",
"normalized",
"Hamming",
"similarity",
"between",
"Eudex",
"hashes",
"of",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_eudex.py#L343-L376 | [
"def",
"sim_eudex",
"(",
"src",
",",
"tar",
",",
"weights",
"=",
"'exponential'",
",",
"max_length",
"=",
"8",
")",
":",
"return",
"Eudex",
"(",
")",
".",
"sim",
"(",
"src",
",",
"tar",
",",
"weights",
",",
"max_length",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Eudex.gen_fibonacci | Yield the next Fibonacci number.
Based on https://www.python-course.eu/generators.php
Starts at Fibonacci number 3 (the second 1)
Yields
------
int
The next Fibonacci number | abydos/distance/_eudex.py | def gen_fibonacci():
"""Yield the next Fibonacci number.
Based on https://www.python-course.eu/generators.php
Starts at Fibonacci number 3 (the second 1)
Yields
------
int
The next Fibonacci number
"""
num_a, num_b = 1, 2
while True:... | def gen_fibonacci():
"""Yield the next Fibonacci number.
Based on https://www.python-course.eu/generators.php
Starts at Fibonacci number 3 (the second 1)
Yields
------
int
The next Fibonacci number
"""
num_a, num_b = 1, 2
while True:... | [
"Yield",
"the",
"next",
"Fibonacci",
"number",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_eudex.py#L48-L63 | [
"def",
"gen_fibonacci",
"(",
")",
":",
"num_a",
",",
"num_b",
"=",
"1",
",",
"2",
"while",
"True",
":",
"yield",
"num_a",
"num_a",
",",
"num_b",
"=",
"num_b",
",",
"num_a",
"+",
"num_b"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Eudex.dist_abs | Calculate the distance between the Eudex hashes of two terms.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
weights : str, iterable, or generator function
The weights or weights generator f... | abydos/distance/_eudex.py | def dist_abs(
self, src, tar, weights='exponential', max_length=8, normalized=False
):
"""Calculate the distance between the Eudex hashes of two terms.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for co... | def dist_abs(
self, src, tar, weights='exponential', max_length=8, normalized=False
):
"""Calculate the distance between the Eudex hashes of two terms.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for co... | [
"Calculate",
"the",
"distance",
"between",
"the",
"Eudex",
"hashes",
"of",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_eudex.py#L87-L200 | [
"def",
"dist_abs",
"(",
"self",
",",
"src",
",",
"tar",
",",
"weights",
"=",
"'exponential'",
",",
"max_length",
"=",
"8",
",",
"normalized",
"=",
"False",
")",
":",
"# Calculate the eudex hashes and XOR them",
"xored",
"=",
"eudex",
"(",
"src",
",",
"max_le... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Eudex.dist | Return normalized distance between the Eudex hashes of two terms.
This is Eudex distance normalized to [0, 1].
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
weights : str, iterable, or generat... | abydos/distance/_eudex.py | def dist(self, src, tar, weights='exponential', max_length=8):
"""Return normalized distance between the Eudex hashes of two terms.
This is Eudex distance normalized to [0, 1].
Parameters
----------
src : str
Source string for comparison
tar : str
... | def dist(self, src, tar, weights='exponential', max_length=8):
"""Return normalized distance between the Eudex hashes of two terms.
This is Eudex distance normalized to [0, 1].
Parameters
----------
src : str
Source string for comparison
tar : str
... | [
"Return",
"normalized",
"distance",
"between",
"the",
"Eudex",
"hashes",
"of",
"two",
"terms",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_eudex.py#L202-L236 | [
"def",
"dist",
"(",
"self",
",",
"src",
",",
"tar",
",",
"weights",
"=",
"'exponential'",
",",
"max_length",
"=",
"8",
")",
":",
"return",
"self",
".",
"dist_abs",
"(",
"src",
",",
"tar",
",",
"weights",
",",
"max_length",
",",
"True",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | euclidean | Return the Euclidean distance between two strings.
This is a wrapper for :py:meth:`Euclidean.dist_abs`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target string (or QGrams/Counter objects) for comparison
qval : int
... | abydos/distance/_euclidean.py | def euclidean(src, tar, qval=2, normalized=False, alphabet=None):
"""Return the Euclidean distance between two strings.
This is a wrapper for :py:meth:`Euclidean.dist_abs`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target... | def euclidean(src, tar, qval=2, normalized=False, alphabet=None):
"""Return the Euclidean distance between two strings.
This is a wrapper for :py:meth:`Euclidean.dist_abs`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target... | [
"Return",
"the",
"Euclidean",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_euclidean.py#L119-L153 | [
"def",
"euclidean",
"(",
"src",
",",
"tar",
",",
"qval",
"=",
"2",
",",
"normalized",
"=",
"False",
",",
"alphabet",
"=",
"None",
")",
":",
"return",
"Euclidean",
"(",
")",
".",
"dist_abs",
"(",
"src",
",",
"tar",
",",
"qval",
",",
"normalized",
",... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | dist_euclidean | Return the normalized Euclidean distance between two strings.
This is a wrapper for :py:meth:`Euclidean.dist`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target string (or QGrams/Counter objects) for comparison
qval : int
... | abydos/distance/_euclidean.py | def dist_euclidean(src, tar, qval=2, alphabet=None):
"""Return the normalized Euclidean distance between two strings.
This is a wrapper for :py:meth:`Euclidean.dist`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target strin... | def dist_euclidean(src, tar, qval=2, alphabet=None):
"""Return the normalized Euclidean distance between two strings.
This is a wrapper for :py:meth:`Euclidean.dist`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target strin... | [
"Return",
"the",
"normalized",
"Euclidean",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_euclidean.py#L156-L189 | [
"def",
"dist_euclidean",
"(",
"src",
",",
"tar",
",",
"qval",
"=",
"2",
",",
"alphabet",
"=",
"None",
")",
":",
"return",
"Euclidean",
"(",
")",
".",
"dist",
"(",
"src",
",",
"tar",
",",
"qval",
",",
"alphabet",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | sim_euclidean | Return the normalized Euclidean similarity of two strings.
This is a wrapper for :py:meth:`Euclidean.sim`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target string (or QGrams/Counter objects) for comparison
qval : int
... | abydos/distance/_euclidean.py | def sim_euclidean(src, tar, qval=2, alphabet=None):
"""Return the normalized Euclidean similarity of two strings.
This is a wrapper for :py:meth:`Euclidean.sim`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target string (or... | def sim_euclidean(src, tar, qval=2, alphabet=None):
"""Return the normalized Euclidean similarity of two strings.
This is a wrapper for :py:meth:`Euclidean.sim`.
Parameters
----------
src : str
Source string (or QGrams/Counter objects) for comparison
tar : str
Target string (or... | [
"Return",
"the",
"normalized",
"Euclidean",
"similarity",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_euclidean.py#L192-L225 | [
"def",
"sim_euclidean",
"(",
"src",
",",
"tar",
",",
"qval",
"=",
"2",
",",
"alphabet",
"=",
"None",
")",
":",
"return",
"Euclidean",
"(",
")",
".",
"sim",
"(",
"src",
",",
"tar",
",",
"qval",
",",
"alphabet",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Lovins._cond_k | Return Lovins' condition K.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met | abydos/stemmer/_lovins.py | def _cond_k(self, word, suffix_len):
"""Return Lovins' condition K.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
retur... | def _cond_k(self, word, suffix_len):
"""Return Lovins' condition K.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
retur... | [
"Return",
"Lovins",
"condition",
"K",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_lovins.py#L213-L232 | [
"def",
"_cond_k",
"(",
"self",
",",
"word",
",",
"suffix_len",
")",
":",
"return",
"(",
"len",
"(",
"word",
")",
"-",
"suffix_len",
">=",
"3",
")",
"and",
"(",
"word",
"[",
"-",
"suffix_len",
"-",
"1",
"]",
"in",
"{",
"'i'",
",",
"'l'",
"}",
"o... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Lovins._cond_n | Return Lovins' condition N.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met | abydos/stemmer/_lovins.py | def _cond_n(self, word, suffix_len):
"""Return Lovins' condition N.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
if le... | def _cond_n(self, word, suffix_len):
"""Return Lovins' condition N.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
if le... | [
"Return",
"Lovins",
"condition",
"N",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_lovins.py#L273-L295 | [
"def",
"_cond_n",
"(",
"self",
",",
"word",
",",
"suffix_len",
")",
":",
"if",
"len",
"(",
"word",
")",
"-",
"suffix_len",
">=",
"3",
":",
"if",
"word",
"[",
"-",
"suffix_len",
"-",
"3",
"]",
"==",
"'s'",
":",
"if",
"len",
"(",
"word",
")",
"-"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Lovins._cond_s | Return Lovins' condition S.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met | abydos/stemmer/_lovins.py | def _cond_s(self, word, suffix_len):
"""Return Lovins' condition S.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
retur... | def _cond_s(self, word, suffix_len):
"""Return Lovins' condition S.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
retur... | [
"Return",
"Lovins",
"condition",
"S",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_lovins.py#L372-L391 | [
"def",
"_cond_s",
"(",
"self",
",",
"word",
",",
"suffix_len",
")",
":",
"return",
"word",
"[",
"-",
"suffix_len",
"-",
"2",
":",
"-",
"suffix_len",
"]",
"==",
"'dr'",
"or",
"(",
"word",
"[",
"-",
"suffix_len",
"-",
"1",
"]",
"==",
"'t'",
"and",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Lovins._cond_x | Return Lovins' condition X.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met | abydos/stemmer/_lovins.py | def _cond_x(self, word, suffix_len):
"""Return Lovins' condition X.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
retur... | def _cond_x(self, word, suffix_len):
"""Return Lovins' condition X.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
retur... | [
"Return",
"Lovins",
"condition",
"X",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_lovins.py#L468-L487 | [
"def",
"_cond_x",
"(",
"self",
",",
"word",
",",
"suffix_len",
")",
":",
"return",
"word",
"[",
"-",
"suffix_len",
"-",
"1",
"]",
"in",
"{",
"'i'",
",",
"'l'",
"}",
"or",
"(",
"word",
"[",
"-",
"suffix_len",
"-",
"3",
":",
"-",
"suffix_len",
"]",... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Lovins._cond_bb | Return Lovins' condition BB.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met | abydos/stemmer/_lovins.py | def _cond_bb(self, word, suffix_len):
"""Return Lovins' condition BB.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
ret... | def _cond_bb(self, word, suffix_len):
"""Return Lovins' condition BB.
Parameters
----------
word : str
Word to check
suffix_len : int
Suffix length
Returns
-------
bool
True if condition is met
"""
ret... | [
"Return",
"Lovins",
"condition",
"BB",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_lovins.py#L545-L565 | [
"def",
"_cond_bb",
"(",
"self",
",",
"word",
",",
"suffix_len",
")",
":",
"return",
"(",
"len",
"(",
"word",
")",
"-",
"suffix_len",
">=",
"3",
"and",
"word",
"[",
"-",
"suffix_len",
"-",
"3",
":",
"-",
"suffix_len",
"]",
"!=",
"'met'",
"and",
"wor... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Lovins.stem | Return Lovins stem.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = Lovins()
>>> stmr.stem('reading')
'read'
>>> stmr.stem('suspension')... | abydos/stemmer/_lovins.py | def stem(self, word):
"""Return Lovins stem.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = Lovins()
>>> stmr.stem('reading')
'read'
... | def stem(self, word):
"""Return Lovins stem.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = Lovins()
>>> stmr.stem('reading')
'read'
... | [
"Return",
"Lovins",
"stem",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_lovins.py#L1014-L1075 | [
"def",
"stem",
"(",
"self",
",",
"word",
")",
":",
"# lowercase, normalize, and compose",
"word",
"=",
"normalize",
"(",
"'NFC'",
",",
"text_type",
"(",
"word",
".",
"lower",
"(",
")",
")",
")",
"for",
"suffix_len",
"in",
"range",
"(",
"11",
",",
"0",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | DamerauLevenshtein.dist_abs | Return the Damerau-Levenshtein distance between two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A 4-tuple representing the cost of the four possible edits:
... | abydos/distance/_damerau_levenshtein.py | def dist_abs(self, src, tar, cost=(1, 1, 1, 1)):
"""Return the Damerau-Levenshtein distance between two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A 4-tuple... | def dist_abs(self, src, tar, cost=(1, 1, 1, 1)):
"""Return the Damerau-Levenshtein distance between two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
cost : tuple
A 4-tuple... | [
"Return",
"the",
"Damerau",
"-",
"Levenshtein",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_damerau_levenshtein.py#L57-L174 | [
"def",
"dist_abs",
"(",
"self",
",",
"src",
",",
"tar",
",",
"cost",
"=",
"(",
"1",
",",
"1",
",",
"1",
",",
"1",
")",
")",
":",
"ins_cost",
",",
"del_cost",
",",
"sub_cost",
",",
"trans_cost",
"=",
"cost",
"if",
"src",
"==",
"tar",
":",
"retur... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | NCDzlib.dist | Return the NCD between two strings using zlib compression.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Compression distance
Examples
... | abydos/distance/_ncd_zlib.py | def dist(self, src, tar):
"""Return the NCD between two strings using zlib compression.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Compress... | def dist(self, src, tar):
"""Return the NCD between two strings using zlib compression.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Compress... | [
"Return",
"the",
"NCD",
"between",
"two",
"strings",
"using",
"zlib",
"compression",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_ncd_zlib.py#L60-L106 | [
"def",
"dist",
"(",
"self",
",",
"src",
",",
"tar",
")",
":",
"if",
"src",
"==",
"tar",
":",
"return",
"0.0",
"src",
"=",
"src",
".",
"encode",
"(",
"'utf-8'",
")",
"tar",
"=",
"tar",
".",
"encode",
"(",
"'utf-8'",
")",
"self",
".",
"_compressor"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | phonex | Return the Phonex code for a word.
This is a wrapper for :py:meth:`Phonex.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the end of the return value with 0s to achieve ... | abydos/phonetic/_phonex.py | def phonex(word, max_length=4, zero_pad=True):
"""Return the Phonex code for a word.
This is a wrapper for :py:meth:`Phonex.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
... | def phonex(word, max_length=4, zero_pad=True):
"""Return the Phonex code for a word.
This is a wrapper for :py:meth:`Phonex.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
... | [
"Return",
"the",
"Phonex",
"code",
"for",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_phonex.py#L167-L198 | [
"def",
"phonex",
"(",
"word",
",",
"max_length",
"=",
"4",
",",
"zero_pad",
"=",
"True",
")",
":",
"return",
"Phonex",
"(",
")",
".",
"encode",
"(",
"word",
",",
"max_length",
",",
"zero_pad",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Phonex.encode | Return the Phonex code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the end of the return value with 0s to achieve a max_length
... | abydos/phonetic/_phonex.py | def encode(self, word, max_length=4, zero_pad=True):
"""Return the Phonex code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the ... | def encode(self, word, max_length=4, zero_pad=True):
"""Return the Phonex code for a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the ... | [
"Return",
"the",
"Phonex",
"code",
"for",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_phonex.py#L47-L164 | [
"def",
"encode",
"(",
"self",
",",
"word",
",",
"max_length",
"=",
"4",
",",
"zero_pad",
"=",
"True",
")",
":",
"name",
"=",
"unicode_normalize",
"(",
"'NFKD'",
",",
"text_type",
"(",
"word",
".",
"upper",
"(",
")",
")",
")",
"name",
"=",
"name",
"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | pylint_color | Return Pylint badge color.
Parameters
----------
score : float
A Pylint score
Returns
-------
str
Badge color | badge_update.py | def pylint_color(score):
"""Return Pylint badge color.
Parameters
----------
score : float
A Pylint score
Returns
-------
str
Badge color
"""
# These are the score cutoffs for each color above.
# I.e. score==10 -> brightgreen, down to 7.5 > score >= 5 -> orange... | def pylint_color(score):
"""Return Pylint badge color.
Parameters
----------
score : float
A Pylint score
Returns
-------
str
Badge color
"""
# These are the score cutoffs for each color above.
# I.e. score==10 -> brightgreen, down to 7.5 > score >= 5 -> orange... | [
"Return",
"Pylint",
"badge",
"color",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/badge_update.py#L38-L59 | [
"def",
"pylint_color",
"(",
"score",
")",
":",
"# These are the score cutoffs for each color above.",
"# I.e. score==10 -> brightgreen, down to 7.5 > score >= 5 -> orange",
"score_cutoffs",
"=",
"(",
"10",
",",
"9.5",
",",
"8.5",
",",
"7.5",
",",
"5",
")",
"for",
"i",
"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | pydocstyle_color | Return pydocstyle badge color.
Parameters
----------
score : float
A pydocstyle score
Returns
-------
str
Badge color | badge_update.py | def pydocstyle_color(score):
"""Return pydocstyle badge color.
Parameters
----------
score : float
A pydocstyle score
Returns
-------
str
Badge color
"""
# These are the score cutoffs for each color above.
# I.e. score==0 -> brightgreen, down to 100 < score <= ... | def pydocstyle_color(score):
"""Return pydocstyle badge color.
Parameters
----------
score : float
A pydocstyle score
Returns
-------
str
Badge color
"""
# These are the score cutoffs for each color above.
# I.e. score==0 -> brightgreen, down to 100 < score <= ... | [
"Return",
"pydocstyle",
"badge",
"color",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/badge_update.py#L74-L95 | [
"def",
"pydocstyle_color",
"(",
"score",
")",
":",
"# These are the score cutoffs for each color above.",
"# I.e. score==0 -> brightgreen, down to 100 < score <= 200 -> orange",
"score_cutoffs",
"=",
"(",
"0",
",",
"10",
",",
"25",
",",
"50",
",",
"100",
")",
"for",
"i",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | flake8_color | Return flake8 badge color.
Parameters
----------
score : float
A flake8 score
Returns
-------
str
Badge color | badge_update.py | def flake8_color(score):
"""Return flake8 badge color.
Parameters
----------
score : float
A flake8 score
Returns
-------
str
Badge color
"""
# These are the score cutoffs for each color above.
# I.e. score==0 -> brightgreen, down to 100 < score <= 200 -> orang... | def flake8_color(score):
"""Return flake8 badge color.
Parameters
----------
score : float
A flake8 score
Returns
-------
str
Badge color
"""
# These are the score cutoffs for each color above.
# I.e. score==0 -> brightgreen, down to 100 < score <= 200 -> orang... | [
"Return",
"flake8",
"badge",
"color",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/badge_update.py#L98-L119 | [
"def",
"flake8_color",
"(",
"score",
")",
":",
"# These are the score cutoffs for each color above.",
"# I.e. score==0 -> brightgreen, down to 100 < score <= 200 -> orange",
"score_cutoffs",
"=",
"(",
"0",
",",
"20",
",",
"50",
",",
"100",
",",
"200",
")",
"for",
"i",
"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | gotoh | Return the Gotoh score of two strings.
This is a wrapper for :py:meth:`Gotoh.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
gap_open : float
The cost of an open alignment gap (1 by default)
gap_ext : fl... | abydos/distance/_gotoh.py | def gotoh(src, tar, gap_open=1, gap_ext=0.4, sim_func=sim_ident):
"""Return the Gotoh score of two strings.
This is a wrapper for :py:meth:`Gotoh.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
gap_open : float
... | def gotoh(src, tar, gap_open=1, gap_ext=0.4, sim_func=sim_ident):
"""Return the Gotoh score of two strings.
This is a wrapper for :py:meth:`Gotoh.dist_abs`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
gap_open : float
... | [
"Return",
"the",
"Gotoh",
"score",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_gotoh.py#L123-L159 | [
"def",
"gotoh",
"(",
"src",
",",
"tar",
",",
"gap_open",
"=",
"1",
",",
"gap_ext",
"=",
"0.4",
",",
"sim_func",
"=",
"sim_ident",
")",
":",
"return",
"Gotoh",
"(",
")",
".",
"dist_abs",
"(",
"src",
",",
"tar",
",",
"gap_open",
",",
"gap_ext",
",",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Gotoh.dist_abs | Return the Gotoh score of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
gap_open : float
The cost of an open alignment gap (1 by default)
gap_ext : float
Th... | abydos/distance/_gotoh.py | def dist_abs(self, src, tar, gap_open=1, gap_ext=0.4, sim_func=sim_ident):
"""Return the Gotoh score of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
gap_open : float
T... | def dist_abs(self, src, tar, gap_open=1, gap_ext=0.4, sim_func=sim_ident):
"""Return the Gotoh score of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
gap_open : float
T... | [
"Return",
"the",
"Gotoh",
"score",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_gotoh.py#L49-L120 | [
"def",
"dist_abs",
"(",
"self",
",",
"src",
",",
"tar",
",",
"gap_open",
"=",
"1",
",",
"gap_ext",
"=",
"0.4",
",",
"sim_func",
"=",
"sim_ident",
")",
":",
"d_mat",
"=",
"np_zeros",
"(",
"(",
"len",
"(",
"src",
")",
"+",
"1",
",",
"len",
"(",
"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Bag.dist_abs | Return the bag distance between two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
int
Bag distance
Examples
--------
>>> c... | abydos/distance/_bag.py | def dist_abs(self, src, tar):
"""Return the bag distance between two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
int
Bag distance
... | def dist_abs(self, src, tar):
"""Return the bag distance between two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
int
Bag distance
... | [
"Return",
"the",
"bag",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_bag.py#L45-L89 | [
"def",
"dist_abs",
"(",
"self",
",",
"src",
",",
"tar",
")",
":",
"if",
"tar",
"==",
"src",
":",
"return",
"0",
"elif",
"not",
"src",
":",
"return",
"len",
"(",
"tar",
")",
"elif",
"not",
"tar",
":",
"return",
"len",
"(",
"src",
")",
"src_bag",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Bag.dist | Return the normalized bag distance between two strings.
Bag distance is normalized by dividing by :math:`max( |src|, |tar| )`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
--... | abydos/distance/_bag.py | def dist(self, src, tar):
"""Return the normalized bag distance between two strings.
Bag distance is normalized by dividing by :math:`max( |src|, |tar| )`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for c... | def dist(self, src, tar):
"""Return the normalized bag distance between two strings.
Bag distance is normalized by dividing by :math:`max( |src|, |tar| )`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for c... | [
"Return",
"the",
"normalized",
"bag",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_bag.py#L91-L128 | [
"def",
"dist",
"(",
"self",
",",
"src",
",",
"tar",
")",
":",
"if",
"tar",
"==",
"src",
":",
"return",
"0.0",
"if",
"not",
"src",
"or",
"not",
"tar",
":",
"return",
"1.0",
"max_length",
"=",
"max",
"(",
"len",
"(",
"src",
")",
",",
"len",
"(",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | CLEFGermanPlus.stem | Return 'CLEF German stemmer plus' stem.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = CLEFGermanPlus()
>>> clef_german_plus('lesen')
'les'
... | abydos/stemmer/_clef_german_plus.py | def stem(self, word):
"""Return 'CLEF German stemmer plus' stem.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = CLEFGermanPlus()
>>> clef_germa... | def stem(self, word):
"""Return 'CLEF German stemmer plus' stem.
Parameters
----------
word : str
The word to stem
Returns
-------
str
Word stem
Examples
--------
>>> stmr = CLEFGermanPlus()
>>> clef_germa... | [
"Return",
"CLEF",
"German",
"stemmer",
"plus",
"stem",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_clef_german_plus.py#L52-L104 | [
"def",
"stem",
"(",
"self",
",",
"word",
")",
":",
"# lowercase, normalize, and compose",
"word",
"=",
"normalize",
"(",
"'NFC'",
",",
"text_type",
"(",
"word",
".",
"lower",
"(",
")",
")",
")",
"# remove umlauts",
"word",
"=",
"word",
".",
"translate",
"(... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | sim_mlipns | Return the MLIPNS similarity of two strings.
This is a wrapper for :py:meth:`MLIPNS.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
A number [0, 1] indicating the maximum similarity score, below... | abydos/distance/_mlipns.py | def sim_mlipns(src, tar, threshold=0.25, max_mismatches=2):
"""Return the MLIPNS similarity of two strings.
This is a wrapper for :py:meth:`MLIPNS.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
... | def sim_mlipns(src, tar, threshold=0.25, max_mismatches=2):
"""Return the MLIPNS similarity of two strings.
This is a wrapper for :py:meth:`MLIPNS.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
... | [
"Return",
"the",
"MLIPNS",
"similarity",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_mlipns.py#L105-L140 | [
"def",
"sim_mlipns",
"(",
"src",
",",
"tar",
",",
"threshold",
"=",
"0.25",
",",
"max_mismatches",
"=",
"2",
")",
":",
"return",
"MLIPNS",
"(",
")",
".",
"sim",
"(",
"src",
",",
"tar",
",",
"threshold",
",",
"max_mismatches",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | dist_mlipns | Return the MLIPNS distance between two strings.
This is a wrapper for :py:meth:`MLIPNS.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
A number [0, 1] indicating the maximum similarity score, b... | abydos/distance/_mlipns.py | def dist_mlipns(src, tar, threshold=0.25, max_mismatches=2):
"""Return the MLIPNS distance between two strings.
This is a wrapper for :py:meth:`MLIPNS.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : floa... | def dist_mlipns(src, tar, threshold=0.25, max_mismatches=2):
"""Return the MLIPNS distance between two strings.
This is a wrapper for :py:meth:`MLIPNS.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : floa... | [
"Return",
"the",
"MLIPNS",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_mlipns.py#L143-L178 | [
"def",
"dist_mlipns",
"(",
"src",
",",
"tar",
",",
"threshold",
"=",
"0.25",
",",
"max_mismatches",
"=",
"2",
")",
":",
"return",
"MLIPNS",
"(",
")",
".",
"dist",
"(",
"src",
",",
"tar",
",",
"threshold",
",",
"max_mismatches",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | MLIPNS.sim | Return the MLIPNS similarity of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
A number [0, 1] indicating the maximum similarity score, below
which... | abydos/distance/_mlipns.py | def sim(self, src, tar, threshold=0.25, max_mismatches=2):
"""Return the MLIPNS similarity of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
A number [... | def sim(self, src, tar, threshold=0.25, max_mismatches=2):
"""Return the MLIPNS similarity of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
A number [... | [
"Return",
"the",
"MLIPNS",
"similarity",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_mlipns.py#L48-L102 | [
"def",
"sim",
"(",
"self",
",",
"src",
",",
"tar",
",",
"threshold",
"=",
"0.25",
",",
"max_mismatches",
"=",
"2",
")",
":",
"if",
"tar",
"==",
"src",
":",
"return",
"1.0",
"if",
"not",
"src",
"or",
"not",
"tar",
":",
"return",
"0.0",
"mismatches",... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | sim | Return a similarity of two strings.
This is a generalized function for calling other similarity functions.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
method : function
Specifies the similarity metric (:py:func:`si... | abydos/distance/__init__.py | def sim(src, tar, method=sim_levenshtein):
"""Return a similarity of two strings.
This is a generalized function for calling other similarity functions.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
method : function
... | def sim(src, tar, method=sim_levenshtein):
"""Return a similarity of two strings.
This is a generalized function for calling other similarity functions.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
method : function
... | [
"Return",
"a",
"similarity",
"of",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/__init__.py#L324-L363 | [
"def",
"sim",
"(",
"src",
",",
"tar",
",",
"method",
"=",
"sim_levenshtein",
")",
":",
"if",
"callable",
"(",
"method",
")",
":",
"return",
"method",
"(",
"src",
",",
"tar",
")",
"else",
":",
"raise",
"AttributeError",
"(",
"'Unknown similarity function: '... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | dist | Return a distance between two strings.
This is a generalized function for calling other distance functions.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
method : function
Specifies the similarity metric (:py:func:`s... | abydos/distance/__init__.py | def dist(src, tar, method=sim_levenshtein):
"""Return a distance between two strings.
This is a generalized function for calling other distance functions.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
method : function
... | def dist(src, tar, method=sim_levenshtein):
"""Return a distance between two strings.
This is a generalized function for calling other distance functions.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
method : function
... | [
"Return",
"a",
"distance",
"between",
"two",
"strings",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/__init__.py#L366-L407 | [
"def",
"dist",
"(",
"src",
",",
"tar",
",",
"method",
"=",
"sim_levenshtein",
")",
":",
"if",
"callable",
"(",
"method",
")",
":",
"return",
"1",
"-",
"method",
"(",
"src",
",",
"tar",
")",
"else",
":",
"raise",
"AttributeError",
"(",
"'Unknown distanc... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | MRA.encode | Return the MRA personal numeric identifier (PNI) for a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The MRA PNI
Examples
--------
>>> pe = MRA()
>>> pe.encode('Christopher')
... | abydos/phonetic/_mra.py | def encode(self, word):
"""Return the MRA personal numeric identifier (PNI) for a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The MRA PNI
Examples
--------
>>> pe = MRA()
... | def encode(self, word):
"""Return the MRA personal numeric identifier (PNI) for a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The MRA PNI
Examples
--------
>>> pe = MRA()
... | [
"Return",
"the",
"MRA",
"personal",
"numeric",
"identifier",
"(",
"PNI",
")",
"for",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_mra.py#L43-L79 | [
"def",
"encode",
"(",
"self",
",",
"word",
")",
":",
"if",
"not",
"word",
":",
"return",
"word",
"word",
"=",
"word",
".",
"upper",
"(",
")",
"word",
"=",
"word",
".",
"replace",
"(",
"'ß',",
" ",
"SS')",
"",
"word",
"=",
"word",
"[",
"0",
"]",... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Porter._m_degree | Return Porter helper function _m_degree value.
m-degree is equal to the number of V to C transitions
Parameters
----------
term : str
The word for which to calculate the m-degree
Returns
-------
int
The m-degree as defined in the Porter ... | abydos/stemmer/_porter.py | def _m_degree(self, term):
"""Return Porter helper function _m_degree value.
m-degree is equal to the number of V to C transitions
Parameters
----------
term : str
The word for which to calculate the m-degree
Returns
-------
int
... | def _m_degree(self, term):
"""Return Porter helper function _m_degree value.
m-degree is equal to the number of V to C transitions
Parameters
----------
term : str
The word for which to calculate the m-degree
Returns
-------
int
... | [
"Return",
"Porter",
"helper",
"function",
"_m_degree",
"value",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_porter.py#L49-L74 | [
"def",
"_m_degree",
"(",
"self",
",",
"term",
")",
":",
"mdeg",
"=",
"0",
"last_was_vowel",
"=",
"False",
"for",
"letter",
"in",
"term",
":",
"if",
"letter",
"in",
"self",
".",
"_vowels",
":",
"last_was_vowel",
"=",
"True",
"else",
":",
"if",
"last_was... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Porter._has_vowel | Return Porter helper function _has_vowel value.
Parameters
----------
term : str
The word to scan for vowels
Returns
-------
bool
True iff a vowel exists in the term (as defined in the Porter
stemmer definition) | abydos/stemmer/_porter.py | def _has_vowel(self, term):
"""Return Porter helper function _has_vowel value.
Parameters
----------
term : str
The word to scan for vowels
Returns
-------
bool
True iff a vowel exists in the term (as defined in the Porter
ste... | def _has_vowel(self, term):
"""Return Porter helper function _has_vowel value.
Parameters
----------
term : str
The word to scan for vowels
Returns
-------
bool
True iff a vowel exists in the term (as defined in the Porter
ste... | [
"Return",
"Porter",
"helper",
"function",
"_has_vowel",
"value",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_porter.py#L76-L94 | [
"def",
"_has_vowel",
"(",
"self",
",",
"term",
")",
":",
"for",
"letter",
"in",
"term",
":",
"if",
"letter",
"in",
"self",
".",
"_vowels",
":",
"return",
"True",
"return",
"False"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Porter._ends_in_doubled_cons | Return Porter helper function _ends_in_doubled_cons value.
Parameters
----------
term : str
The word to check for a final doubled consonant
Returns
-------
bool
True iff the stem ends in a doubled consonant (as defined in the
Porter s... | abydos/stemmer/_porter.py | def _ends_in_doubled_cons(self, term):
"""Return Porter helper function _ends_in_doubled_cons value.
Parameters
----------
term : str
The word to check for a final doubled consonant
Returns
-------
bool
True iff the stem ends in a doubled... | def _ends_in_doubled_cons(self, term):
"""Return Porter helper function _ends_in_doubled_cons value.
Parameters
----------
term : str
The word to check for a final doubled consonant
Returns
-------
bool
True iff the stem ends in a doubled... | [
"Return",
"Porter",
"helper",
"function",
"_ends_in_doubled_cons",
"value",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_porter.py#L96-L115 | [
"def",
"_ends_in_doubled_cons",
"(",
"self",
",",
"term",
")",
":",
"return",
"(",
"len",
"(",
"term",
")",
">",
"1",
"and",
"term",
"[",
"-",
"1",
"]",
"not",
"in",
"self",
".",
"_vowels",
"and",
"term",
"[",
"-",
"2",
"]",
"==",
"term",
"[",
... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Porter._ends_in_cvc | Return Porter helper function _ends_in_cvc value.
Parameters
----------
term : str
The word to scan for cvc
Returns
-------
bool
True iff the stem ends in cvc (as defined in the Porter stemmer
definition) | abydos/stemmer/_porter.py | def _ends_in_cvc(self, term):
"""Return Porter helper function _ends_in_cvc value.
Parameters
----------
term : str
The word to scan for cvc
Returns
-------
bool
True iff the stem ends in cvc (as defined in the Porter stemmer
... | def _ends_in_cvc(self, term):
"""Return Porter helper function _ends_in_cvc value.
Parameters
----------
term : str
The word to scan for cvc
Returns
-------
bool
True iff the stem ends in cvc (as defined in the Porter stemmer
... | [
"Return",
"Porter",
"helper",
"function",
"_ends_in_cvc",
"value",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_porter.py#L117-L137 | [
"def",
"_ends_in_cvc",
"(",
"self",
",",
"term",
")",
":",
"return",
"len",
"(",
"term",
")",
">",
"2",
"and",
"(",
"term",
"[",
"-",
"1",
"]",
"not",
"in",
"self",
".",
"_vowels",
"and",
"term",
"[",
"-",
"2",
"]",
"in",
"self",
".",
"_vowels"... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | Porter.stem | Return Porter stem.
Parameters
----------
word : str
The word to stem
early_english : bool
Set to True in order to remove -eth & -est (2nd & 3rd person
singular verbal agreement suffixes)
Returns
-------
str
Word s... | abydos/stemmer/_porter.py | def stem(self, word, early_english=False):
"""Return Porter stem.
Parameters
----------
word : str
The word to stem
early_english : bool
Set to True in order to remove -eth & -est (2nd & 3rd person
singular verbal agreement suffixes)
... | def stem(self, word, early_english=False):
"""Return Porter stem.
Parameters
----------
word : str
The word to stem
early_english : bool
Set to True in order to remove -eth & -est (2nd & 3rd person
singular verbal agreement suffixes)
... | [
"Return",
"Porter",
"stem",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_porter.py#L139-L371 | [
"def",
"stem",
"(",
"self",
",",
"word",
",",
"early_english",
"=",
"False",
")",
":",
"# lowercase, normalize, and compose",
"word",
"=",
"normalize",
"(",
"'NFC'",
",",
"text_type",
"(",
"word",
".",
"lower",
"(",
")",
")",
")",
"# Return word if stem is sho... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | soundex_br | Return the SoundexBR encoding of a word.
This is a wrapper for :py:meth:`SoundexBR.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the end of the return value with 0s to... | abydos/phonetic/_soundex_br.py | def soundex_br(word, max_length=4, zero_pad=True):
"""Return the SoundexBR encoding of a word.
This is a wrapper for :py:meth:`SoundexBR.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad... | def soundex_br(word, max_length=4, zero_pad=True):
"""Return the SoundexBR encoding of a word.
This is a wrapper for :py:meth:`SoundexBR.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad... | [
"Return",
"the",
"SoundexBR",
"encoding",
"of",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_soundex_br.py#L116-L151 | [
"def",
"soundex_br",
"(",
"word",
",",
"max_length",
"=",
"4",
",",
"zero_pad",
"=",
"True",
")",
":",
"return",
"SoundexBR",
"(",
")",
".",
"encode",
"(",
"word",
",",
"max_length",
",",
"zero_pad",
")"
] | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | SoundexBR.encode | Return the SoundexBR encoding of a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pad the end of the return value with 0s to achieve a max_length
... | abydos/phonetic/_soundex_br.py | def encode(self, word, max_length=4, zero_pad=True):
"""Return the SoundexBR encoding of a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pa... | def encode(self, word, max_length=4, zero_pad=True):
"""Return the SoundexBR encoding of a word.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to 4)
zero_pad : bool
Pa... | [
"Return",
"the",
"SoundexBR",
"encoding",
"of",
"a",
"word",
"."
] | chrislit/abydos | python | https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_soundex_br.py#L53-L113 | [
"def",
"encode",
"(",
"self",
",",
"word",
",",
"max_length",
"=",
"4",
",",
"zero_pad",
"=",
"True",
")",
":",
"word",
"=",
"unicode_normalize",
"(",
"'NFKD'",
",",
"text_type",
"(",
"word",
".",
"upper",
"(",
")",
")",
")",
"word",
"=",
"''",
"."... | 165466b3ff6afd8024a4c8660421b0c4e7773db9 |
valid | filter_symlog | Symmetrical logarithmic scale.
Optional arguments:
*base*:
The base of the logarithm. | diagram.py | def filter_symlog(y, base=10.0):
"""Symmetrical logarithmic scale.
Optional arguments:
*base*:
The base of the logarithm.
"""
log_base = np.log(base)
sign = np.sign(y)
logs = np.log(np.abs(y) / log_base)
return sign * logs | def filter_symlog(y, base=10.0):
"""Symmetrical logarithmic scale.
Optional arguments:
*base*:
The base of the logarithm.
"""
log_base = np.log(base)
sign = np.sign(y)
logs = np.log(np.abs(y) / log_base)
return sign * logs | [
"Symmetrical",
"logarithmic",
"scale",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L165-L176 | [
"def",
"filter_symlog",
"(",
"y",
",",
"base",
"=",
"10.0",
")",
":",
"log_base",
"=",
"np",
".",
"log",
"(",
"base",
")",
"sign",
"=",
"np",
".",
"sign",
"(",
"y",
")",
"logs",
"=",
"np",
".",
"log",
"(",
"np",
".",
"abs",
"(",
"y",
")",
"... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | filter_savitzky_golay | Smooth (and optionally differentiate) with a Savitzky-Golay filter. | diagram.py | def filter_savitzky_golay(y, window_size=5, order=2, deriv=0, rate=1):
"""Smooth (and optionally differentiate) with a Savitzky-Golay filter."""
try:
window_size = np.abs(np.int(window_size))
order = np.abs(np.int(order))
except ValueError:
raise ValueError('window_size and order mus... | def filter_savitzky_golay(y, window_size=5, order=2, deriv=0, rate=1):
"""Smooth (and optionally differentiate) with a Savitzky-Golay filter."""
try:
window_size = np.abs(np.int(window_size))
order = np.abs(np.int(order))
except ValueError:
raise ValueError('window_size and order mus... | [
"Smooth",
"(",
"and",
"optionally",
"differentiate",
")",
"with",
"a",
"Savitzky",
"-",
"Golay",
"filter",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L179-L212 | [
"def",
"filter_savitzky_golay",
"(",
"y",
",",
"window_size",
"=",
"5",
",",
"order",
"=",
"2",
",",
"deriv",
"=",
"0",
",",
"rate",
"=",
"1",
")",
":",
"try",
":",
"window_size",
"=",
"np",
".",
"abs",
"(",
"np",
".",
"int",
"(",
"window_size",
... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | usage_function | Show usage and available curve functions. | diagram.py | def usage_function(parser):
"""Show usage and available curve functions."""
parser.print_usage()
print('')
print('available functions:')
for function in sorted(FUNCTION):
doc = FUNCTION[function].__doc__.strip().splitlines()[0]
print(' %-12s %s' % (function + ':', doc))
retur... | def usage_function(parser):
"""Show usage and available curve functions."""
parser.print_usage()
print('')
print('available functions:')
for function in sorted(FUNCTION):
doc = FUNCTION[function].__doc__.strip().splitlines()[0]
print(' %-12s %s' % (function + ':', doc))
retur... | [
"Show",
"usage",
"and",
"available",
"curve",
"functions",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L1067-L1076 | [
"def",
"usage_function",
"(",
"parser",
")",
":",
"parser",
".",
"print_usage",
"(",
")",
"print",
"(",
"''",
")",
"print",
"(",
"'available functions:'",
")",
"for",
"function",
"in",
"sorted",
"(",
"FUNCTION",
")",
":",
"doc",
"=",
"FUNCTION",
"[",
"fu... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | usage_palette | Show usage and available palettes. | diagram.py | def usage_palette(parser):
"""Show usage and available palettes."""
parser.print_usage()
print('')
print('available palettes:')
for palette in sorted(PALETTE):
print(' %-12s' % (palette,))
return 0 | def usage_palette(parser):
"""Show usage and available palettes."""
parser.print_usage()
print('')
print('available palettes:')
for palette in sorted(PALETTE):
print(' %-12s' % (palette,))
return 0 | [
"Show",
"usage",
"and",
"available",
"palettes",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L1079-L1087 | [
"def",
"usage_palette",
"(",
"parser",
")",
":",
"parser",
".",
"print_usage",
"(",
")",
"print",
"(",
"''",
")",
"print",
"(",
"'available palettes:'",
")",
"for",
"palette",
"in",
"sorted",
"(",
"PALETTE",
")",
":",
"print",
"(",
"' %-12s'",
"%",
"(... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | run | Main entrypoint if invoked via the command line. | diagram.py | def run():
"""Main entrypoint if invoked via the command line."""
import argparse
parser = argparse.ArgumentParser(
description=(
'Text mode diagrams using UTF-8 characters and fancy colors.'
),
epilog="""
(1): only works for the horizontal bar graph, the first argum... | def run():
"""Main entrypoint if invoked via the command line."""
import argparse
parser = argparse.ArgumentParser(
description=(
'Text mode diagrams using UTF-8 characters and fancy colors.'
),
epilog="""
(1): only works for the horizontal bar graph, the first argum... | [
"Main",
"entrypoint",
"if",
"invoked",
"via",
"the",
"command",
"line",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L1090-L1254 | [
"def",
"run",
"(",
")",
":",
"import",
"argparse",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"(",
"'Text mode diagrams using UTF-8 characters and fancy colors.'",
")",
",",
"epilog",
"=",
"\"\"\"\n (1): only works for the horizontal bar g... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Terminal.size | Get the current terminal size. | diagram.py | def size(self):
"""Get the current terminal size."""
for fd in range(3):
cr = self._ioctl_GWINSZ(fd)
if cr:
break
if not cr:
try:
fd = os.open(os.ctermid(), os.O_RDONLY)
cr = self._ioctl_GWINSZ(fd)
... | def size(self):
"""Get the current terminal size."""
for fd in range(3):
cr = self._ioctl_GWINSZ(fd)
if cr:
break
if not cr:
try:
fd = os.open(os.ctermid(), os.O_RDONLY)
cr = self._ioctl_GWINSZ(fd)
... | [
"Get",
"the",
"current",
"terminal",
"size",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L79-L97 | [
"def",
"size",
"(",
"self",
")",
":",
"for",
"fd",
"in",
"range",
"(",
"3",
")",
":",
"cr",
"=",
"self",
".",
"_ioctl_GWINSZ",
"(",
"fd",
")",
"if",
"cr",
":",
"break",
"if",
"not",
"cr",
":",
"try",
":",
"fd",
"=",
"os",
".",
"open",
"(",
... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Terminal.color | Get the escape sequence for indexed color ``index``.
The ``index`` is a color index in the 256 color space. The color space
consists of:
* 0x00-0x0f: default EGA colors
* 0x10-0xe7: 6x6x6 RGB cubes
* 0xe8-0xff: gray scale ramp | diagram.py | def color(self, index):
"""Get the escape sequence for indexed color ``index``.
The ``index`` is a color index in the 256 color space. The color space
consists of:
* 0x00-0x0f: default EGA colors
* 0x10-0xe7: 6x6x6 RGB cubes
* 0xe8-0xff: gray scale ramp
"""
... | def color(self, index):
"""Get the escape sequence for indexed color ``index``.
The ``index`` is a color index in the 256 color space. The color space
consists of:
* 0x00-0x0f: default EGA colors
* 0x10-0xe7: 6x6x6 RGB cubes
* 0xe8-0xff: gray scale ramp
"""
... | [
"Get",
"the",
"escape",
"sequence",
"for",
"indexed",
"color",
"index",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L121-L137 | [
"def",
"color",
"(",
"self",
",",
"index",
")",
":",
"if",
"self",
".",
"colors",
"==",
"16",
":",
"if",
"index",
">=",
"8",
":",
"return",
"self",
".",
"csi",
"(",
"'bold'",
")",
"+",
"self",
".",
"csi",
"(",
"'setaf'",
",",
"index",
"-",
"8",... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Terminal.csi | Return the escape sequence for the selected Control Sequence. | diagram.py | def csi(self, capname, *args):
"""Return the escape sequence for the selected Control Sequence."""
value = curses.tigetstr(capname)
if value is None:
return b''
else:
return curses.tparm(value, *args) | def csi(self, capname, *args):
"""Return the escape sequence for the selected Control Sequence."""
value = curses.tigetstr(capname)
if value is None:
return b''
else:
return curses.tparm(value, *args) | [
"Return",
"the",
"escape",
"sequence",
"for",
"the",
"selected",
"Control",
"Sequence",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L139-L145 | [
"def",
"csi",
"(",
"self",
",",
"capname",
",",
"*",
"args",
")",
":",
"value",
"=",
"curses",
".",
"tigetstr",
"(",
"capname",
")",
"if",
"value",
"is",
"None",
":",
"return",
"b''",
"else",
":",
"return",
"curses",
".",
"tparm",
"(",
"value",
","... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Terminal.csi_wrap | Return a value wrapped in the selected CSI and does a reset. | diagram.py | def csi_wrap(self, value, capname, *args):
"""Return a value wrapped in the selected CSI and does a reset."""
if isinstance(value, str):
value = value.encode('utf-8')
return b''.join([
self.csi(capname, *args),
value,
self.csi('sgr0'),
]) | def csi_wrap(self, value, capname, *args):
"""Return a value wrapped in the selected CSI and does a reset."""
if isinstance(value, str):
value = value.encode('utf-8')
return b''.join([
self.csi(capname, *args),
value,
self.csi('sgr0'),
]) | [
"Return",
"a",
"value",
"wrapped",
"in",
"the",
"selected",
"CSI",
"and",
"does",
"a",
"reset",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L147-L155 | [
"def",
"csi_wrap",
"(",
"self",
",",
"value",
",",
"capname",
",",
"*",
"args",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"value",
"=",
"value",
".",
"encode",
"(",
"'utf-8'",
")",
"return",
"b''",
".",
"join",
"(",
"[",
"... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Graph.consume | Read points from istream and output to ostream. | diagram.py | def consume(self, istream, ostream, batch=False):
"""Read points from istream and output to ostream."""
datapoints = [] # List of 2-tuples
if batch:
sleep = max(0.01, self.option.sleep)
fd = istream.fileno()
while True:
try:
... | def consume(self, istream, ostream, batch=False):
"""Read points from istream and output to ostream."""
datapoints = [] # List of 2-tuples
if batch:
sleep = max(0.01, self.option.sleep)
fd = istream.fileno()
while True:
try:
... | [
"Read",
"points",
"from",
"istream",
"and",
"output",
"to",
"ostream",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L373-L415 | [
"def",
"consume",
"(",
"self",
",",
"istream",
",",
"ostream",
",",
"batch",
"=",
"False",
")",
":",
"datapoints",
"=",
"[",
"]",
"# List of 2-tuples",
"if",
"batch",
":",
"sleep",
"=",
"max",
"(",
"0.01",
",",
"self",
".",
"option",
".",
"sleep",
")... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Graph.consume_line | Consume data from a line. | diagram.py | def consume_line(self, line):
"""Consume data from a line."""
data = RE_VALUE_KEY.split(line.strip(), 1)
if len(data) == 1:
return float(data[0]), None
else:
return float(data[0]), data[1].strip() | def consume_line(self, line):
"""Consume data from a line."""
data = RE_VALUE_KEY.split(line.strip(), 1)
if len(data) == 1:
return float(data[0]), None
else:
return float(data[0]), data[1].strip() | [
"Consume",
"data",
"from",
"a",
"line",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L417-L423 | [
"def",
"consume_line",
"(",
"self",
",",
"line",
")",
":",
"data",
"=",
"RE_VALUE_KEY",
".",
"split",
"(",
"line",
".",
"strip",
"(",
")",
",",
"1",
")",
"if",
"len",
"(",
"data",
")",
"==",
"1",
":",
"return",
"float",
"(",
"data",
"[",
"0",
"... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Graph.update | Add a set of data points. | diagram.py | def update(self, points, values=None):
"""Add a set of data points."""
self.values = values or [None] * len(points)
if np is None:
if self.option.function:
warnings.warn('numpy not available, function ignored')
self.points = points
self.minimu... | def update(self, points, values=None):
"""Add a set of data points."""
self.values = values or [None] * len(points)
if np is None:
if self.option.function:
warnings.warn('numpy not available, function ignored')
self.points = points
self.minimu... | [
"Add",
"a",
"set",
"of",
"data",
"points",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L430-L452 | [
"def",
"update",
"(",
"self",
",",
"points",
",",
"values",
"=",
"None",
")",
":",
"self",
".",
"values",
"=",
"values",
"or",
"[",
"None",
"]",
"*",
"len",
"(",
"points",
")",
"if",
"np",
"is",
"None",
":",
"if",
"self",
".",
"option",
".",
"f... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Graph.color_ramp | Generate a color ramp for the current screen height. | diagram.py | def color_ramp(self, size):
"""Generate a color ramp for the current screen height."""
color = PALETTE.get(self.option.palette, {})
color = color.get(self.term.colors, None)
color_ramp = []
if color is not None:
ratio = len(color) / float(size)
for i in ra... | def color_ramp(self, size):
"""Generate a color ramp for the current screen height."""
color = PALETTE.get(self.option.palette, {})
color = color.get(self.term.colors, None)
color_ramp = []
if color is not None:
ratio = len(color) / float(size)
for i in ra... | [
"Generate",
"a",
"color",
"ramp",
"for",
"the",
"current",
"screen",
"height",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L454-L464 | [
"def",
"color_ramp",
"(",
"self",
",",
"size",
")",
":",
"color",
"=",
"PALETTE",
".",
"get",
"(",
"self",
".",
"option",
".",
"palette",
",",
"{",
"}",
")",
"color",
"=",
"color",
".",
"get",
"(",
"self",
".",
"term",
".",
"colors",
",",
"None",... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Graph.human | Convert the input ``size`` to human readable, short form. | diagram.py | def human(self, size, base=1000, units=' kMGTZ'):
"""Convert the input ``size`` to human readable, short form."""
sign = '+' if size >= 0 else '-'
size = abs(size)
if size < 1000:
return '%s%d' % (sign, size)
for i, suffix in enumerate(units):
unit = 1000 ... | def human(self, size, base=1000, units=' kMGTZ'):
"""Convert the input ``size`` to human readable, short form."""
sign = '+' if size >= 0 else '-'
size = abs(size)
if size < 1000:
return '%s%d' % (sign, size)
for i, suffix in enumerate(units):
unit = 1000 ... | [
"Convert",
"the",
"input",
"size",
"to",
"human",
"readable",
"short",
"form",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L466-L480 | [
"def",
"human",
"(",
"self",
",",
"size",
",",
"base",
"=",
"1000",
",",
"units",
"=",
"' kMGTZ'",
")",
":",
"sign",
"=",
"'+'",
"if",
"size",
">=",
"0",
"else",
"'-'",
"size",
"=",
"abs",
"(",
"size",
")",
"if",
"size",
"<",
"1000",
":",
"retu... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Graph.apply_function | Run the filter function on the provided points. | diagram.py | def apply_function(self, points):
"""Run the filter function on the provided points."""
if not self.option.function:
return points
if np is None:
raise ImportError('numpy is not available')
if ':' in self.option.function:
function, arguments = self.o... | def apply_function(self, points):
"""Run the filter function on the provided points."""
if not self.option.function:
return points
if np is None:
raise ImportError('numpy is not available')
if ':' in self.option.function:
function, arguments = self.o... | [
"Run",
"the",
"filter",
"function",
"on",
"the",
"provided",
"points",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L482-L509 | [
"def",
"apply_function",
"(",
"self",
",",
"points",
")",
":",
"if",
"not",
"self",
".",
"option",
".",
"function",
":",
"return",
"points",
"if",
"np",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"'numpy is not available'",
")",
"if",
"':'",
"in",
"... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Graph.line | Resolve the points to make a line between two points. | diagram.py | def line(self, p1, p2, resolution=1):
"""Resolve the points to make a line between two points."""
xdiff = max(p1.x, p2.x) - min(p1.x, p2.x)
ydiff = max(p1.y, p2.y) - min(p1.y, p2.y)
xdir = [-1, 1][int(p1.x <= p2.x)]
ydir = [-1, 1][int(p1.y <= p2.y)]
r = int(round(max(xdif... | def line(self, p1, p2, resolution=1):
"""Resolve the points to make a line between two points."""
xdiff = max(p1.x, p2.x) - min(p1.x, p2.x)
ydiff = max(p1.y, p2.y) - min(p1.y, p2.y)
xdir = [-1, 1][int(p1.x <= p2.x)]
ydir = [-1, 1][int(p1.y <= p2.y)]
r = int(round(max(xdif... | [
"Resolve",
"the",
"points",
"to",
"make",
"a",
"line",
"between",
"two",
"points",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L518-L537 | [
"def",
"line",
"(",
"self",
",",
"p1",
",",
"p2",
",",
"resolution",
"=",
"1",
")",
":",
"xdiff",
"=",
"max",
"(",
"p1",
".",
"x",
",",
"p2",
".",
"x",
")",
"-",
"min",
"(",
"p1",
".",
"x",
",",
"p2",
".",
"x",
")",
"ydiff",
"=",
"max",
... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | Graph.set_text | Set a text value in the screen canvas. | diagram.py | def set_text(self, point, text):
"""Set a text value in the screen canvas."""
if not self.option.legend:
return
if not isinstance(point, Point):
point = Point(point)
for offset, char in enumerate(str(text)):
self.screen.canvas[point.y][point.x + offs... | def set_text(self, point, text):
"""Set a text value in the screen canvas."""
if not self.option.legend:
return
if not isinstance(point, Point):
point = Point(point)
for offset, char in enumerate(str(text)):
self.screen.canvas[point.y][point.x + offs... | [
"Set",
"a",
"text",
"value",
"in",
"the",
"screen",
"canvas",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L552-L561 | [
"def",
"set_text",
"(",
"self",
",",
"point",
",",
"text",
")",
":",
"if",
"not",
"self",
".",
"option",
".",
"legend",
":",
"return",
"if",
"not",
"isinstance",
"(",
"point",
",",
"Point",
")",
":",
"point",
"=",
"Point",
"(",
"point",
")",
"for",... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | AxisGraph.render | Render graph to stream. | diagram.py | def render(self, stream):
"""Render graph to stream."""
encoding = self.option.encoding or self.term.encoding or "utf8"
if self.option.color:
ramp = self.color_ramp(self.size.y)[::-1]
else:
ramp = None
if self.cycle >= 1 and self.lines:
strea... | def render(self, stream):
"""Render graph to stream."""
encoding = self.option.encoding or self.term.encoding or "utf8"
if self.option.color:
ramp = self.color_ramp(self.size.y)[::-1]
else:
ramp = None
if self.cycle >= 1 and self.lines:
strea... | [
"Render",
"graph",
"to",
"stream",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L603-L652 | [
"def",
"render",
"(",
"self",
",",
"stream",
")",
":",
"encoding",
"=",
"self",
".",
"option",
".",
"encoding",
"or",
"self",
".",
"term",
".",
"encoding",
"or",
"\"utf8\"",
"if",
"self",
".",
"option",
".",
"color",
":",
"ramp",
"=",
"self",
".",
... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | AxisGraph._normalised_numpy | Normalised data points using numpy. | diagram.py | def _normalised_numpy(self):
"""Normalised data points using numpy."""
dx = (self.screen.width / float(len(self.points)))
oy = (self.screen.height)
points = np.array(self.points) - self.minimum
points = points * 4.0 / self.extents * self.size.y
for x, y in enumerate(point... | def _normalised_numpy(self):
"""Normalised data points using numpy."""
dx = (self.screen.width / float(len(self.points)))
oy = (self.screen.height)
points = np.array(self.points) - self.minimum
points = points * 4.0 / self.extents * self.size.y
for x, y in enumerate(point... | [
"Normalised",
"data",
"points",
"using",
"numpy",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L662-L672 | [
"def",
"_normalised_numpy",
"(",
"self",
")",
":",
"dx",
"=",
"(",
"self",
".",
"screen",
".",
"width",
"/",
"float",
"(",
"len",
"(",
"self",
".",
"points",
")",
")",
")",
"oy",
"=",
"(",
"self",
".",
"screen",
".",
"height",
")",
"points",
"=",... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | AxisGraph._normalised_python | Normalised data points using pure Python. | diagram.py | def _normalised_python(self):
"""Normalised data points using pure Python."""
dx = (self.screen.width / float(len(self.points)))
oy = (self.screen.height)
for x, point in enumerate(self.points):
y = (point - self.minimum) * 4.0 / self.extents * self.size.y
yield P... | def _normalised_python(self):
"""Normalised data points using pure Python."""
dx = (self.screen.width / float(len(self.points)))
oy = (self.screen.height)
for x, point in enumerate(self.points):
y = (point - self.minimum) * 4.0 / self.extents * self.size.y
yield P... | [
"Normalised",
"data",
"points",
"using",
"pure",
"Python",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L674-L683 | [
"def",
"_normalised_python",
"(",
"self",
")",
":",
"dx",
"=",
"(",
"self",
".",
"screen",
".",
"width",
"/",
"float",
"(",
"len",
"(",
"self",
".",
"points",
")",
")",
")",
"oy",
"=",
"(",
"self",
".",
"screen",
".",
"height",
")",
"for",
"x",
... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | AxisGraph.null | Zero crossing value. | diagram.py | def null(self):
"""Zero crossing value."""
if not self.option.axis:
return -1
else:
return self.screen.height - (
-self.minimum * 4.0 / self.extents * self.size.y
) | def null(self):
"""Zero crossing value."""
if not self.option.axis:
return -1
else:
return self.screen.height - (
-self.minimum * 4.0 / self.extents * self.size.y
) | [
"Zero",
"crossing",
"value",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L691-L698 | [
"def",
"null",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"option",
".",
"axis",
":",
"return",
"-",
"1",
"else",
":",
"return",
"self",
".",
"screen",
".",
"height",
"-",
"(",
"-",
"self",
".",
"minimum",
"*",
"4.0",
"/",
"self",
".",
"e... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | AxisGraph.set | Set pixel at (x, y) point. | diagram.py | def set(self, point):
"""Set pixel at (x, y) point."""
if not isinstance(point, Point):
point = Point(point)
rx = self.round(point.x)
ry = self.round(point.y)
item = Point((rx >> 1, min(ry >> 2, self.size.y)))
self.screen[item] |= self.pixels[ry & 3][rx & 1] | def set(self, point):
"""Set pixel at (x, y) point."""
if not isinstance(point, Point):
point = Point(point)
rx = self.round(point.x)
ry = self.round(point.y)
item = Point((rx >> 1, min(ry >> 2, self.size.y)))
self.screen[item] |= self.pixels[ry & 3][rx & 1] | [
"Set",
"pixel",
"at",
"(",
"x",
"y",
")",
"point",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L700-L709 | [
"def",
"set",
"(",
"self",
",",
"point",
")",
":",
"if",
"not",
"isinstance",
"(",
"point",
",",
"Point",
")",
":",
"point",
"=",
"Point",
"(",
"point",
")",
"rx",
"=",
"self",
".",
"round",
"(",
"point",
".",
"x",
")",
"ry",
"=",
"self",
".",
... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | AxisGraph.unset | Unset pixel at (x, y) point. | diagram.py | def unset(self, point):
"""Unset pixel at (x, y) point."""
if not isinstance(point, Point):
point = Point(point)
x, y = self.round(point.x) >> 1, self.round(point.y) >> 2
if (x, y) not in self.screen:
return
if isinstance(self.screen[y][x], int):
... | def unset(self, point):
"""Unset pixel at (x, y) point."""
if not isinstance(point, Point):
point = Point(point)
x, y = self.round(point.x) >> 1, self.round(point.y) >> 2
if (x, y) not in self.screen:
return
if isinstance(self.screen[y][x], int):
... | [
"Unset",
"pixel",
"at",
"(",
"x",
"y",
")",
"point",
"."
] | tehmaze/diagram | python | https://github.com/tehmaze/diagram/blob/1701526a91c14dc8ebc6452c45c8ec9a563a56db/diagram.py#L711-L728 | [
"def",
"unset",
"(",
"self",
",",
"point",
")",
":",
"if",
"not",
"isinstance",
"(",
"point",
",",
"Point",
")",
":",
"point",
"=",
"Point",
"(",
"point",
")",
"x",
",",
"y",
"=",
"self",
".",
"round",
"(",
"point",
".",
"x",
")",
">>",
"1",
... | 1701526a91c14dc8ebc6452c45c8ec9a563a56db |
valid | KBinXML.mem_size | used when allocating memory ingame | kbinxml/kbinxml.py | def mem_size(self):
'''used when allocating memory ingame'''
data_len = self._data_mem_size
node_count = len(list(self.xml_doc.iter(tag=etree.Element)))
if self.compressed:
size = 52 * node_count + data_len + 630
else:
tags_len = 0
for e in s... | def mem_size(self):
'''used when allocating memory ingame'''
data_len = self._data_mem_size
node_count = len(list(self.xml_doc.iter(tag=etree.Element)))
if self.compressed:
size = 52 * node_count + data_len + 630
else:
tags_len = 0
for e in s... | [
"used",
"when",
"allocating",
"memory",
"ingame"
] | mon/kbinxml | python | https://github.com/mon/kbinxml/blob/ca4a6e309ec458dd359f1bf25f91a4443758365a/kbinxml/kbinxml.py#L106-L126 | [
"def",
"mem_size",
"(",
"self",
")",
":",
"data_len",
"=",
"self",
".",
"_data_mem_size",
"node_count",
"=",
"len",
"(",
"list",
"(",
"self",
".",
"xml_doc",
".",
"iter",
"(",
"tag",
"=",
"etree",
".",
"Element",
")",
")",
")",
"if",
"self",
".",
"... | ca4a6e309ec458dd359f1bf25f91a4443758365a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.