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
manhattan
Return the Manhattan distance between two strings. This is a wrapper for :py:meth:`Manhattan.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/_manhattan.py
def manhattan(src, tar, qval=2, normalized=False, alphabet=None): """Return the Manhattan distance between two strings. This is a wrapper for :py:meth:`Manhattan.dist_abs`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target...
def manhattan(src, tar, qval=2, normalized=False, alphabet=None): """Return the Manhattan distance between two strings. This is a wrapper for :py:meth:`Manhattan.dist_abs`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target...
[ "Return", "the", "Manhattan", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_manhattan.py#L121-L156
[ "def", "manhattan", "(", "src", ",", "tar", ",", "qval", "=", "2", ",", "normalized", "=", "False", ",", "alphabet", "=", "None", ")", ":", "return", "Manhattan", "(", ")", ".", "dist_abs", "(", "src", ",", "tar", ",", "qval", ",", "normalized", ",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_manhattan
Return the normalized Manhattan distance between two strings. This is a wrapper for :py:meth:`Manhattan.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/_manhattan.py
def dist_manhattan(src, tar, qval=2, alphabet=None): """Return the normalized Manhattan distance between two strings. This is a wrapper for :py:meth:`Manhattan.dist`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target strin...
def dist_manhattan(src, tar, qval=2, alphabet=None): """Return the normalized Manhattan distance between two strings. This is a wrapper for :py:meth:`Manhattan.dist`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target strin...
[ "Return", "the", "normalized", "Manhattan", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_manhattan.py#L159-L192
[ "def", "dist_manhattan", "(", "src", ",", "tar", ",", "qval", "=", "2", ",", "alphabet", "=", "None", ")", ":", "return", "Manhattan", "(", ")", ".", "dist", "(", "src", ",", "tar", ",", "qval", ",", "alphabet", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_manhattan
Return the normalized Manhattan similarity of two strings. This is a wrapper for :py:meth:`Manhattan.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/_manhattan.py
def sim_manhattan(src, tar, qval=2, alphabet=None): """Return the normalized Manhattan similarity of two strings. This is a wrapper for :py:meth:`Manhattan.sim`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or...
def sim_manhattan(src, tar, qval=2, alphabet=None): """Return the normalized Manhattan similarity of two strings. This is a wrapper for :py:meth:`Manhattan.sim`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or...
[ "Return", "the", "normalized", "Manhattan", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_manhattan.py#L195-L228
[ "def", "sim_manhattan", "(", "src", ",", "tar", ",", "qval", "=", "2", ",", "alphabet", "=", "None", ")", ":", "return", "Manhattan", "(", ")", ".", "sim", "(", "src", ",", "tar", ",", "qval", ",", "alphabet", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_jaro_winkler
Return the Jaro or Jaro-Winkler similarity of two strings. This is a wrapper for :py:meth:`JaroWinkler.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison qval : int The length of each q-gram (defaults to 1: characte...
abydos/distance/_jaro_winkler.py
def sim_jaro_winkler( src, tar, qval=1, mode='winkler', long_strings=False, boost_threshold=0.7, scaling_factor=0.1, ): """Return the Jaro or Jaro-Winkler similarity of two strings. This is a wrapper for :py:meth:`JaroWinkler.sim`. Parameters ---------- src : str ...
def sim_jaro_winkler( src, tar, qval=1, mode='winkler', long_strings=False, boost_threshold=0.7, scaling_factor=0.1, ): """Return the Jaro or Jaro-Winkler similarity of two strings. This is a wrapper for :py:meth:`JaroWinkler.sim`. Parameters ---------- src : str ...
[ "Return", "the", "Jaro", "or", "Jaro", "-", "Winkler", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_jaro_winkler.py#L234-L303
[ "def", "sim_jaro_winkler", "(", "src", ",", "tar", ",", "qval", "=", "1", ",", "mode", "=", "'winkler'", ",", "long_strings", "=", "False", ",", "boost_threshold", "=", "0.7", ",", "scaling_factor", "=", "0.1", ",", ")", ":", "return", "JaroWinkler", "("...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_jaro_winkler
Return the Jaro or Jaro-Winkler distance between two strings. This is a wrapper for :py:meth:`JaroWinkler.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison qval : int The length of each q-gram (defaults to 1: char...
abydos/distance/_jaro_winkler.py
def dist_jaro_winkler( src, tar, qval=1, mode='winkler', long_strings=False, boost_threshold=0.7, scaling_factor=0.1, ): """Return the Jaro or Jaro-Winkler distance between two strings. This is a wrapper for :py:meth:`JaroWinkler.dist`. Parameters ---------- src : str ...
def dist_jaro_winkler( src, tar, qval=1, mode='winkler', long_strings=False, boost_threshold=0.7, scaling_factor=0.1, ): """Return the Jaro or Jaro-Winkler distance between two strings. This is a wrapper for :py:meth:`JaroWinkler.dist`. Parameters ---------- src : str ...
[ "Return", "the", "Jaro", "or", "Jaro", "-", "Winkler", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_jaro_winkler.py#L306-L375
[ "def", "dist_jaro_winkler", "(", "src", ",", "tar", ",", "qval", "=", "1", ",", "mode", "=", "'winkler'", ",", "long_strings", "=", "False", ",", "boost_threshold", "=", "0.7", ",", "scaling_factor", "=", "0.1", ",", ")", ":", "return", "JaroWinkler", "(...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
JaroWinkler.sim
Return the Jaro or Jaro-Winkler similarity of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison qval : int The length of each q-gram (defaults to 1: character-wise matching) ...
abydos/distance/_jaro_winkler.py
def sim( self, src, tar, qval=1, mode='winkler', long_strings=False, boost_threshold=0.7, scaling_factor=0.1, ): """Return the Jaro or Jaro-Winkler similarity of two strings. Parameters ---------- src : str ...
def sim( self, src, tar, qval=1, mode='winkler', long_strings=False, boost_threshold=0.7, scaling_factor=0.1, ): """Return the Jaro or Jaro-Winkler similarity of two strings. Parameters ---------- src : str ...
[ "Return", "the", "Jaro", "or", "Jaro", "-", "Winkler", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_jaro_winkler.py#L55-L231
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ",", "qval", "=", "1", ",", "mode", "=", "'winkler'", ",", "long_strings", "=", "False", ",", "boost_threshold", "=", "0.7", ",", "scaling_factor", "=", "0.1", ",", ")", ":", "if", "mode", "==", "'...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
hamming
Return the Hamming distance between two strings. This is a wrapper for :py:meth:`Hamming.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool If True (default), this returns the Hamming distance ...
abydos/distance/_hamming.py
def hamming(src, tar, diff_lens=True): """Return the Hamming distance between two strings. This is a wrapper for :py:meth:`Hamming.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool If True...
def hamming(src, tar, diff_lens=True): """Return the Hamming distance between two strings. This is a wrapper for :py:meth:`Hamming.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool If True...
[ "Return", "the", "Hamming", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_hamming.py#L149-L184
[ "def", "hamming", "(", "src", ",", "tar", ",", "diff_lens", "=", "True", ")", ":", "return", "Hamming", "(", ")", ".", "dist_abs", "(", "src", ",", "tar", ",", "diff_lens", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_hamming
Return the normalized Hamming distance between two strings. This is a wrapper for :py:meth:`Hamming.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool If True (default), this returns the Hamming di...
abydos/distance/_hamming.py
def dist_hamming(src, tar, diff_lens=True): """Return the normalized Hamming distance between two strings. This is a wrapper for :py:meth:`Hamming.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool ...
def dist_hamming(src, tar, diff_lens=True): """Return the normalized Hamming distance between two strings. This is a wrapper for :py:meth:`Hamming.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool ...
[ "Return", "the", "normalized", "Hamming", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_hamming.py#L187-L222
[ "def", "dist_hamming", "(", "src", ",", "tar", ",", "diff_lens", "=", "True", ")", ":", "return", "Hamming", "(", ")", ".", "dist", "(", "src", ",", "tar", ",", "diff_lens", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_hamming
Return the normalized Hamming similarity of two strings. This is a wrapper for :py:meth:`Hamming.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool If True (default), this returns the Hamming distan...
abydos/distance/_hamming.py
def sim_hamming(src, tar, diff_lens=True): """Return the normalized Hamming similarity of two strings. This is a wrapper for :py:meth:`Hamming.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool ...
def sim_hamming(src, tar, diff_lens=True): """Return the normalized Hamming similarity of two strings. This is a wrapper for :py:meth:`Hamming.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool ...
[ "Return", "the", "normalized", "Hamming", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_hamming.py#L225-L260
[ "def", "sim_hamming", "(", "src", ",", "tar", ",", "diff_lens", "=", "True", ")", ":", "return", "Hamming", "(", ")", ".", "sim", "(", "src", ",", "tar", ",", "diff_lens", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Hamming.dist_abs
Return the Hamming distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool If True (default), this returns the Hamming distance for those ch...
abydos/distance/_hamming.py
def dist_abs(self, src, tar, diff_lens=True): """Return the Hamming distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool If True (default), t...
def dist_abs(self, src, tar, diff_lens=True): """Return the Hamming distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison diff_lens : bool If True (default), t...
[ "Return", "the", "Hamming", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_hamming.py#L46-L99
[ "def", "dist_abs", "(", "self", ",", "src", ",", "tar", ",", "diff_lens", "=", "True", ")", ":", "if", "not", "diff_lens", "and", "len", "(", "src", ")", "!=", "len", "(", "tar", ")", ":", "raise", "ValueError", "(", "'Undefined for sequences of unequal ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Hamming.dist
Return the normalized Hamming distance between two strings. Hamming distance normalized to the interval [0, 1]. The Hamming distance is normalized by dividing it by the greater of the number of characters in src & tar (unless diff_lens is set to False, in which case an exception is rai...
abydos/distance/_hamming.py
def dist(self, src, tar, diff_lens=True): """Return the normalized Hamming distance between two strings. Hamming distance normalized to the interval [0, 1]. The Hamming distance is normalized by dividing it by the greater of the number of characters in src & tar (unless diff_le...
def dist(self, src, tar, diff_lens=True): """Return the normalized Hamming distance between two strings. Hamming distance normalized to the interval [0, 1]. The Hamming distance is normalized by dividing it by the greater of the number of characters in src & tar (unless diff_le...
[ "Return", "the", "normalized", "Hamming", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_hamming.py#L101-L146
[ "def", "dist", "(", "self", ",", "src", ",", "tar", ",", "diff_lens", "=", "True", ")", ":", "if", "src", "==", "tar", ":", "return", "0.0", "return", "self", ".", "dist_abs", "(", "src", ",", "tar", ",", "diff_lens", ")", "/", "max", "(", "len",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Metaphone.encode
Return the Metaphone code for a word. Based on Lawrence Philips' Pick BASIC code from 1990 :cite:`Philips:1990`, as described in :cite:`Philips:1990b`. This incorporates some corrections to the above code, particularly some of those suggested by Michael Kuhn in :cite:`Kuhn:1995`. ...
abydos/phonetic/_metaphone.py
def encode(self, word, max_length=-1): """Return the Metaphone code for a word. Based on Lawrence Philips' Pick BASIC code from 1990 :cite:`Philips:1990`, as described in :cite:`Philips:1990b`. This incorporates some corrections to the above code, particularly some of those sugg...
def encode(self, word, max_length=-1): """Return the Metaphone code for a word. Based on Lawrence Philips' Pick BASIC code from 1990 :cite:`Philips:1990`, as described in :cite:`Philips:1990b`. This incorporates some corrections to the above code, particularly some of those sugg...
[ "Return", "the", "Metaphone", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_metaphone.py#L50-L254
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "-", "1", ")", ":", "# Require a max_length of at least 4", "if", "max_length", "!=", "-", "1", ":", "max_length", "=", "max", "(", "4", ",", "max_length", ")", "else", ":", "max_length", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dolby
r"""Return the Dolby Code of a name. This is a wrapper for :py:meth:`Dolby.encode`. Parameters ---------- word : str The word to transform max_length : int Maximum length of the returned Dolby code -- this also activates the fixed-length code mode if it is greater than 0 ...
abydos/phonetic/_dolby.py
def dolby(word, max_length=-1, keep_vowels=False, vowel_char='*'): r"""Return the Dolby Code of a name. This is a wrapper for :py:meth:`Dolby.encode`. Parameters ---------- word : str The word to transform max_length : int Maximum length of the returned Dolby code -- this also ...
def dolby(word, max_length=-1, keep_vowels=False, vowel_char='*'): r"""Return the Dolby Code of a name. This is a wrapper for :py:meth:`Dolby.encode`. Parameters ---------- word : str The word to transform max_length : int Maximum length of the returned Dolby code -- this also ...
[ "r", "Return", "the", "Dolby", "Code", "of", "a", "name", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_dolby.py#L249-L316
[ "def", "dolby", "(", "word", ",", "max_length", "=", "-", "1", ",", "keep_vowels", "=", "False", ",", "vowel_char", "=", "'*'", ")", ":", "return", "Dolby", "(", ")", ".", "encode", "(", "word", ",", "max_length", ",", "keep_vowels", ",", "vowel_char",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Dolby.encode
r"""Return the Dolby Code of a name. Parameters ---------- word : str The word to transform max_length : int Maximum length of the returned Dolby code -- this also activates the fixed-length code mode if it is greater than 0 keep_vowels : bool...
abydos/phonetic/_dolby.py
def encode(self, word, max_length=-1, keep_vowels=False, vowel_char='*'): r"""Return the Dolby Code of a name. Parameters ---------- word : str The word to transform max_length : int Maximum length of the returned Dolby code -- this also activates ...
def encode(self, word, max_length=-1, keep_vowels=False, vowel_char='*'): r"""Return the Dolby Code of a name. Parameters ---------- word : str The word to transform max_length : int Maximum length of the returned Dolby code -- this also activates ...
[ "r", "Return", "the", "Dolby", "Code", "of", "a", "name", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_dolby.py#L47-L246
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "-", "1", ",", "keep_vowels", "=", "False", ",", "vowel_char", "=", "'*'", ")", ":", "# uppercase, normalize, decompose, and filter non-A-Z out", "word", "=", "unicode_normalize", "(", "'NFKD'", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
pshp_soundex_last
Calculate the PSHP Soundex/Viewex Coding of a last name. This is a wrapper for :py:meth:`PSHPSoundexLast.encode`. Parameters ---------- lname : str The last name to encode max_length : int The length of the code returned (defaults to 4) german : bool Set to True if the ...
abydos/phonetic/_pshp_soundex_last.py
def pshp_soundex_last(lname, max_length=4, german=False): """Calculate the PSHP Soundex/Viewex Coding of a last name. This is a wrapper for :py:meth:`PSHPSoundexLast.encode`. Parameters ---------- lname : str The last name to encode max_length : int The length of the code retur...
def pshp_soundex_last(lname, max_length=4, german=False): """Calculate the PSHP Soundex/Viewex Coding of a last name. This is a wrapper for :py:meth:`PSHPSoundexLast.encode`. Parameters ---------- lname : str The last name to encode max_length : int The length of the code retur...
[ "Calculate", "the", "PSHP", "Soundex", "/", "Viewex", "Coding", "of", "a", "last", "name", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_pshp_soundex_last.py#L207-L240
[ "def", "pshp_soundex_last", "(", "lname", ",", "max_length", "=", "4", ",", "german", "=", "False", ")", ":", "return", "PSHPSoundexLast", "(", ")", ".", "encode", "(", "lname", ",", "max_length", ",", "german", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
PSHPSoundexLast.encode
Calculate the PSHP Soundex/Viewex Coding of a last name. Parameters ---------- lname : str The last name to encode max_length : int The length of the code returned (defaults to 4) german : bool Set to True if the name is German (different rule...
abydos/phonetic/_pshp_soundex_last.py
def encode(self, lname, max_length=4, german=False): """Calculate the PSHP Soundex/Viewex Coding of a last name. Parameters ---------- lname : str The last name to encode max_length : int The length of the code returned (defaults to 4) german : bo...
def encode(self, lname, max_length=4, german=False): """Calculate the PSHP Soundex/Viewex Coding of a last name. Parameters ---------- lname : str The last name to encode max_length : int The length of the code returned (defaults to 4) german : bo...
[ "Calculate", "the", "PSHP", "Soundex", "/", "Viewex", "Coding", "of", "a", "last", "name", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_pshp_soundex_last.py#L58-L204
[ "def", "encode", "(", "self", ",", "lname", ",", "max_length", "=", "4", ",", "german", "=", "False", ")", ":", "lname", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "lname", ".", "upper", "(", ")", ")", ")", "lname", "=", "lname",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SkeletonKey.fingerprint
Return the skeleton key. Parameters ---------- word : str The word to transform into its skeleton key Returns ------- str The skeleton key Examples -------- >>> sk = SkeletonKey() >>> sk.fingerprint('The quick bro...
abydos/fingerprint/_skeleton_key.py
def fingerprint(self, word): """Return the skeleton key. Parameters ---------- word : str The word to transform into its skeleton key Returns ------- str The skeleton key Examples -------- >>> sk = SkeletonKey() ...
def fingerprint(self, word): """Return the skeleton key. Parameters ---------- word : str The word to transform into its skeleton key Returns ------- str The skeleton key Examples -------- >>> sk = SkeletonKey() ...
[ "Return", "the", "skeleton", "key", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_skeleton_key.py#L49-L89
[ "def", "fingerprint", "(", "self", ",", "word", ")", ":", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upper", "(", ")", ")", ")", "word", "=", "''", ".", "join", "(", "c", "for", "c", "in", "word", "if", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
nysiis
Return the NYSIIS code for a word. This is a wrapper for :py:meth:`NYSIIS.encode`. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 6) of the code to return modified : bool Indicates whether to use USDA modified NYSIIS ...
abydos/phonetic/_nysiis.py
def nysiis(word, max_length=6, modified=False): """Return the NYSIIS code for a word. This is a wrapper for :py:meth:`NYSIIS.encode`. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 6) of the code to return modified : bool...
def nysiis(word, max_length=6, modified=False): """Return the NYSIIS code for a word. This is a wrapper for :py:meth:`NYSIIS.encode`. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 6) of the code to return modified : bool...
[ "Return", "the", "NYSIIS", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_nysiis.py#L223-L266
[ "def", "nysiis", "(", "word", ",", "max_length", "=", "6", ",", "modified", "=", "False", ")", ":", "return", "NYSIIS", "(", ")", ".", "encode", "(", "word", ",", "max_length", ",", "modified", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NYSIIS.encode
Return the NYSIIS code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 6) of the code to return modified : bool Indicates whether to use USDA modified NYSIIS Returns ...
abydos/phonetic/_nysiis.py
def encode(self, word, max_length=6, modified=False): """Return the NYSIIS code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 6) of the code to return modified : bool In...
def encode(self, word, max_length=6, modified=False): """Return the NYSIIS code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 6) of the code to return modified : bool In...
[ "Return", "the", "NYSIIS", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_nysiis.py#L49-L220
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "6", ",", "modified", "=", "False", ")", ":", "# Require a max_length of at least 6", "if", "max_length", ">", "-", "1", ":", "max_length", "=", "max", "(", "6", ",", "max_length", ")", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
chebyshev
r"""Return the Chebyshev distance between two strings. This is a wrapper for the :py:meth:`Chebyshev.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/_chebyshev.py
def chebyshev(src, tar, qval=2, alphabet=None): r"""Return the Chebyshev distance between two strings. This is a wrapper for the :py:meth:`Chebyshev.dist_abs`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or Q...
def chebyshev(src, tar, qval=2, alphabet=None): r"""Return the Chebyshev distance between two strings. This is a wrapper for the :py:meth:`Chebyshev.dist_abs`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or Q...
[ "r", "Return", "the", "Chebyshev", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_chebyshev.py#L120-L157
[ "def", "chebyshev", "(", "src", ",", "tar", ",", "qval", "=", "2", ",", "alphabet", "=", "None", ")", ":", "return", "Chebyshev", "(", ")", ".", "dist_abs", "(", "src", ",", "tar", ",", "qval", ",", "alphabet", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Chebyshev.dist_abs
r"""Return the Chebyshev distance between 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-...
abydos/distance/_chebyshev.py
def dist_abs(self, src, tar, qval=2, alphabet=None): r"""Return the Chebyshev distance between two strings. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/Counter objects) for co...
def dist_abs(self, src, tar, qval=2, alphabet=None): r"""Return the Chebyshev distance between two strings. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/Counter objects) for co...
[ "r", "Return", "the", "Chebyshev", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_chebyshev.py#L43-L81
[ "def", "dist_abs", "(", "self", ",", "src", ",", "tar", ",", "qval", "=", "2", ",", "alphabet", "=", "None", ")", ":", "return", "super", "(", "self", ".", "__class__", ",", "self", ")", ".", "dist_abs", "(", "src", ",", "tar", ",", "qval", ",", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
mean_pairwise_similarity
Calculate the mean pairwise similarity of a collection of strings. Takes the mean of the pairwise similarity between each member of a collection, optionally in both directions (for asymmetric similarity metrics. Parameters ---------- collection : list A collection of terms or a string ...
abydos/stats/_pairwise.py
def mean_pairwise_similarity( collection, metric=sim, mean_func=hmean, symmetric=False ): """Calculate the mean pairwise similarity of a collection of strings. Takes the mean of the pairwise similarity between each member of a collection, optionally in both directions (for asymmetric similarity met...
def mean_pairwise_similarity( collection, metric=sim, mean_func=hmean, symmetric=False ): """Calculate the mean pairwise similarity of a collection of strings. Takes the mean of the pairwise similarity between each member of a collection, optionally in both directions (for asymmetric similarity met...
[ "Calculate", "the", "mean", "pairwise", "similarity", "of", "a", "collection", "of", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_pairwise.py#L39-L107
[ "def", "mean_pairwise_similarity", "(", "collection", ",", "metric", "=", "sim", ",", "mean_func", "=", "hmean", ",", "symmetric", "=", "False", ")", ":", "if", "not", "callable", "(", "mean_func", ")", ":", "raise", "ValueError", "(", "'mean_func must be a fu...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
pairwise_similarity_statistics
Calculate the pairwise similarity statistics a collection of strings. Calculate pairwise similarities among members of two collections, returning the maximum, minimum, mean (according to a supplied function, arithmetic mean, by default), and (population) standard deviation of those similarities. P...
abydos/stats/_pairwise.py
def pairwise_similarity_statistics( src_collection, tar_collection, metric=sim, mean_func=amean, symmetric=False, ): """Calculate the pairwise similarity statistics a collection of strings. Calculate pairwise similarities among members of two collections, returning the maximum, minimum,...
def pairwise_similarity_statistics( src_collection, tar_collection, metric=sim, mean_func=amean, symmetric=False, ): """Calculate the pairwise similarity statistics a collection of strings. Calculate pairwise similarities among members of two collections, returning the maximum, minimum,...
[ "Calculate", "the", "pairwise", "similarity", "statistics", "a", "collection", "of", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_pairwise.py#L110-L192
[ "def", "pairwise_similarity_statistics", "(", "src_collection", ",", "tar_collection", ",", "metric", "=", "sim", ",", "mean_func", "=", "amean", ",", "symmetric", "=", "False", ",", ")", ":", "if", "not", "callable", "(", "mean_func", ")", ":", "raise", "Va...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Porter2.stem
Return the Porter2 (Snowball English) 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 ------- ...
abydos/stemmer/_porter2.py
def stem(self, word, early_english=False): """Return the Porter2 (Snowball English) 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 agree...
def stem(self, word, early_english=False): """Return the Porter2 (Snowball English) 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 agree...
[ "Return", "the", "Porter2", "(", "Snowball", "English", ")", "stem", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_porter2.py#L87-L377
[ "def", "stem", "(", "self", ",", "word", ",", "early_english", "=", "False", ")", ":", "# lowercase, normalize, and compose", "word", "=", "normalize", "(", "'NFC'", ",", "text_type", "(", "word", ".", "lower", "(", ")", ")", ")", "# replace apostrophe-like ch...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
synoname_toolcode
Build the Synoname toolcode. This is a wrapper for :py:meth:`SynonameToolcode.fingerprint`. Parameters ---------- lname : str Last name fname : str First name (can be blank) qual : str Qualifier normalize : int Normalization mode (0, 1, or 2) Returns ...
abydos/fingerprint/_synoname.py
def synoname_toolcode(lname, fname='', qual='', normalize=0): """Build the Synoname toolcode. This is a wrapper for :py:meth:`SynonameToolcode.fingerprint`. Parameters ---------- lname : str Last name fname : str First name (can be blank) qual : str Qualifier no...
def synoname_toolcode(lname, fname='', qual='', normalize=0): """Build the Synoname toolcode. This is a wrapper for :py:meth:`SynonameToolcode.fingerprint`. Parameters ---------- lname : str Last name fname : str First name (can be blank) qual : str Qualifier no...
[ "Build", "the", "Synoname", "toolcode", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_synoname.py#L495-L535
[ "def", "synoname_toolcode", "(", "lname", ",", "fname", "=", "''", ",", "qual", "=", "''", ",", "normalize", "=", "0", ")", ":", "return", "SynonameToolcode", "(", ")", ".", "fingerprint", "(", "lname", ",", "fname", ",", "qual", ",", "normalize", ")" ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SynonameToolcode.fingerprint
Build the Synoname toolcode. Parameters ---------- lname : str Last name fname : str First name (can be blank) qual : str Qualifier normalize : int Normalization mode (0, 1, or 2) Returns ------- tu...
abydos/fingerprint/_synoname.py
def fingerprint(self, lname, fname='', qual='', normalize=0): """Build the Synoname toolcode. Parameters ---------- lname : str Last name fname : str First name (can be blank) qual : str Qualifier normalize : int No...
def fingerprint(self, lname, fname='', qual='', normalize=0): """Build the Synoname toolcode. Parameters ---------- lname : str Last name fname : str First name (can be blank) qual : str Qualifier normalize : int No...
[ "Build", "the", "Synoname", "toolcode", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_synoname.py#L270-L492
[ "def", "fingerprint", "(", "self", ",", "lname", ",", "fname", "=", "''", ",", "qual", "=", "''", ",", "normalize", "=", "0", ")", ":", "lname", "=", "lname", ".", "lower", "(", ")", "fname", "=", "fname", ".", "lower", "(", ")", "qual", "=", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
uealite
Return UEA-Lite stem. This is a wrapper for :py:meth:`UEALite.stem`. Parameters ---------- word : str The word to stem max_word_length : int The maximum word length allowed max_acro_length : int The maximum acronym length allowed return_rule_no : bool If Tru...
abydos/stemmer/_uea_lite.py
def uealite( word, max_word_length=20, max_acro_length=8, return_rule_no=False, var='standard', ): """Return UEA-Lite stem. This is a wrapper for :py:meth:`UEALite.stem`. Parameters ---------- word : str The word to stem max_word_length : int The maximum wor...
def uealite( word, max_word_length=20, max_acro_length=8, return_rule_no=False, var='standard', ): """Return UEA-Lite stem. This is a wrapper for :py:meth:`UEALite.stem`. Parameters ---------- word : str The word to stem max_word_length : int The maximum wor...
[ "Return", "UEA", "-", "Lite", "stem", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_uea_lite.py#L763-L811
[ "def", "uealite", "(", "word", ",", "max_word_length", "=", "20", ",", "max_acro_length", "=", "8", ",", "return_rule_no", "=", "False", ",", "var", "=", "'standard'", ",", ")", ":", "return", "UEALite", "(", ")", ".", "stem", "(", "word", ",", "max_wo...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
UEALite.stem
Return UEA-Lite stem. Parameters ---------- word : str The word to stem max_word_length : int The maximum word length allowed max_acro_length : int The maximum acronym length allowed return_rule_no : bool If True, returns t...
abydos/stemmer/_uea_lite.py
def stem( self, word, max_word_length=20, max_acro_length=8, return_rule_no=False, var='standard', ): """Return UEA-Lite stem. Parameters ---------- word : str The word to stem max_word_length : int The ...
def stem( self, word, max_word_length=20, max_acro_length=8, return_rule_no=False, var='standard', ): """Return UEA-Lite stem. Parameters ---------- word : str The word to stem max_word_length : int The ...
[ "Return", "UEA", "-", "Lite", "stem", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_uea_lite.py#L620-L760
[ "def", "stem", "(", "self", ",", "word", ",", "max_word_length", "=", "20", ",", "max_acro_length", "=", "8", ",", "return_rule_no", "=", "False", ",", "var", "=", "'standard'", ",", ")", ":", "def", "_stem_with_duplicate_character_check", "(", "word", ",", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
_Snowball._sb_r1
Return the R1 region, as defined in the Porter2 specification. Parameters ---------- term : str The term to examine r1_prefixes : set Prefixes to consider Returns ------- int Length of the R1 region
abydos/stemmer/_snowball.py
def _sb_r1(self, term, r1_prefixes=None): """Return the R1 region, as defined in the Porter2 specification. Parameters ---------- term : str The term to examine r1_prefixes : set Prefixes to consider Returns ------- int ...
def _sb_r1(self, term, r1_prefixes=None): """Return the R1 region, as defined in the Porter2 specification. Parameters ---------- term : str The term to examine r1_prefixes : set Prefixes to consider Returns ------- int ...
[ "Return", "the", "R1", "region", "as", "defined", "in", "the", "Porter2", "specification", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball.py#L42-L69
[ "def", "_sb_r1", "(", "self", ",", "term", ",", "r1_prefixes", "=", "None", ")", ":", "vowel_found", "=", "False", "if", "hasattr", "(", "r1_prefixes", ",", "'__iter__'", ")", ":", "for", "prefix", "in", "r1_prefixes", ":", "if", "term", "[", ":", "len...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
_Snowball._sb_r2
Return the R2 region, as defined in the Porter2 specification. Parameters ---------- term : str The term to examine r1_prefixes : set Prefixes to consider Returns ------- int Length of the R1 region
abydos/stemmer/_snowball.py
def _sb_r2(self, term, r1_prefixes=None): """Return the R2 region, as defined in the Porter2 specification. Parameters ---------- term : str The term to examine r1_prefixes : set Prefixes to consider Returns ------- int ...
def _sb_r2(self, term, r1_prefixes=None): """Return the R2 region, as defined in the Porter2 specification. Parameters ---------- term : str The term to examine r1_prefixes : set Prefixes to consider Returns ------- int ...
[ "Return", "the", "R2", "region", "as", "defined", "in", "the", "Porter2", "specification", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball.py#L71-L88
[ "def", "_sb_r2", "(", "self", ",", "term", ",", "r1_prefixes", "=", "None", ")", ":", "r1_start", "=", "self", ".", "_sb_r1", "(", "term", ",", "r1_prefixes", ")", "return", "r1_start", "+", "self", ".", "_sb_r1", "(", "term", "[", "r1_start", ":", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
_Snowball._sb_ends_in_short_syllable
Return True iff term ends in a short syllable. (...according to the Porter2 specification.) NB: This is akin to the CVC test from the Porter stemmer. The description is unfortunately poor/ambiguous. Parameters ---------- term : str The term to examine ...
abydos/stemmer/_snowball.py
def _sb_ends_in_short_syllable(self, term): """Return True iff term ends in a short syllable. (...according to the Porter2 specification.) NB: This is akin to the CVC test from the Porter stemmer. The description is unfortunately poor/ambiguous. Parameters ---------- ...
def _sb_ends_in_short_syllable(self, term): """Return True iff term ends in a short syllable. (...according to the Porter2 specification.) NB: This is akin to the CVC test from the Porter stemmer. The description is unfortunately poor/ambiguous. Parameters ---------- ...
[ "Return", "True", "iff", "term", "ends", "in", "a", "short", "syllable", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball.py#L90-L121
[ "def", "_sb_ends_in_short_syllable", "(", "self", ",", "term", ")", ":", "if", "not", "term", ":", "return", "False", "if", "len", "(", "term", ")", "==", "2", ":", "if", "term", "[", "-", "2", "]", "in", "self", ".", "_vowels", "and", "term", "[",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
_Snowball._sb_short_word
Return True iff term is a short word. (...according to the Porter2 specification.) Parameters ---------- term : str The term to examine r1_prefixes : set Prefixes to consider Returns ------- bool True iff term is a sh...
abydos/stemmer/_snowball.py
def _sb_short_word(self, term, r1_prefixes=None): """Return True iff term is a short word. (...according to the Porter2 specification.) Parameters ---------- term : str The term to examine r1_prefixes : set Prefixes to consider Returns ...
def _sb_short_word(self, term, r1_prefixes=None): """Return True iff term is a short word. (...according to the Porter2 specification.) Parameters ---------- term : str The term to examine r1_prefixes : set Prefixes to consider Returns ...
[ "Return", "True", "iff", "term", "is", "a", "short", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball.py#L123-L145
[ "def", "_sb_short_word", "(", "self", ",", "term", ",", "r1_prefixes", "=", "None", ")", ":", "if", "self", ".", "_sb_r1", "(", "term", ",", "r1_prefixes", ")", "==", "len", "(", "term", ")", "and", "self", ".", "_sb_ends_in_short_syllable", "(", "term",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
_Snowball._sb_has_vowel
Return Porter helper function _sb_has_vowel value. Parameters ---------- term : str The term to examine Returns ------- bool True iff a vowel exists in the term (as defined in the Porter stemmer definition)
abydos/stemmer/_snowball.py
def _sb_has_vowel(self, term): """Return Porter helper function _sb_has_vowel value. Parameters ---------- term : str The term to examine Returns ------- bool True iff a vowel exists in the term (as defined in the Porter stemm...
def _sb_has_vowel(self, term): """Return Porter helper function _sb_has_vowel value. Parameters ---------- term : str The term to examine Returns ------- bool True iff a vowel exists in the term (as defined in the Porter stemm...
[ "Return", "Porter", "helper", "function", "_sb_has_vowel", "value", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball.py#L147-L165
[ "def", "_sb_has_vowel", "(", "self", ",", "term", ")", ":", "for", "letter", "in", "term", ":", "if", "letter", "in", "self", ".", "_vowels", ":", "return", "True", "return", "False" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Eudex.encode
Return the eudex phonetic hash of a word. Parameters ---------- word : str The word to transform max_length : int The length in bits of the code returned (default 8) Returns ------- int The eudex hash Examples ...
abydos/phonetic/_eudex.py
def encode(self, word, max_length=8): """Return the eudex phonetic hash of a word. Parameters ---------- word : str The word to transform max_length : int The length in bits of the code returned (default 8) Returns ------- int ...
def encode(self, word, max_length=8): """Return the eudex phonetic hash of a word. Parameters ---------- word : str The word to transform max_length : int The length in bits of the code returned (default 8) Returns ------- int ...
[ "Return", "the", "eudex", "phonetic", "hash", "of", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_eudex.py#L171-L232
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "8", ")", ":", "# Lowercase input & filter unknown characters", "word", "=", "''", ".", "join", "(", "char", "for", "char", "in", "word", ".", "lower", "(", ")", "if", "char", "in", "self...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
roger_root
Return the Roger Root code for a word. This is a wrapper for :py:meth:`RogerRoot.encode`. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return zero_pad : bool Pad the end of the return value with 0s...
abydos/phonetic/_roger_root.py
def roger_root(word, max_length=5, zero_pad=True): """Return the Roger Root code for a word. This is a wrapper for :py:meth:`RogerRoot.encode`. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return zero_...
def roger_root(word, max_length=5, zero_pad=True): """Return the Roger Root code for a word. This is a wrapper for :py:meth:`RogerRoot.encode`. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return zero_...
[ "Return", "the", "Roger", "Root", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_roger_root.py#L203-L234
[ "def", "roger_root", "(", "word", ",", "max_length", "=", "5", ",", "zero_pad", "=", "True", ")", ":", "return", "RogerRoot", "(", ")", ".", "encode", "(", "word", ",", "max_length", ",", "zero_pad", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
RogerRoot.encode
Return the Roger Root code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return zero_pad : bool Pad the end of the return value with 0s to achieve a max_length...
abydos/phonetic/_roger_root.py
def encode(self, word, max_length=5, zero_pad=True): """Return the Roger Root code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return zero_pad : bool ...
def encode(self, word, max_length=5, zero_pad=True): """Return the Roger Root code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return zero_pad : bool ...
[ "Return", "the", "Roger", "Root", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_roger_root.py#L141-L200
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "5", ",", "zero_pad", "=", "True", ")", ":", "# uppercase, normalize, decompose, and filter non-A-Z out", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upp...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Koelner.encode
Return the Kölner Phonetik (numeric output) code for a word. While the output code is numeric, it is still a str because 0s can lead the code. Parameters ---------- word : str The word to transform Returns ------- str The Kölner ...
abydos/phonetic/_koelner.py
def encode(self, word): """Return the Kölner Phonetik (numeric output) code for a word. While the output code is numeric, it is still a str because 0s can lead the code. Parameters ---------- word : str The word to transform Returns ------- ...
def encode(self, word): """Return the Kölner Phonetik (numeric output) code for a word. While the output code is numeric, it is still a str because 0s can lead the code. Parameters ---------- word : str The word to transform Returns ------- ...
[ "Return", "the", "Kölner", "Phonetik", "(", "numeric", "output", ")", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_koelner.py#L57-L197
[ "def", "encode", "(", "self", ",", "word", ")", ":", "def", "_after", "(", "word", ",", "pos", ",", "letters", ")", ":", "\"\"\"Return True if word[pos] follows one of the supplied letters.\n\n Parameters\n ----------\n word : str\n ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Koelner._to_alpha
Convert a Kölner Phonetik code from numeric to alphabetic. Parameters ---------- num : str or int A numeric Kölner Phonetik representation Returns ------- str An alphabetic representation of the same word Examples -------- ...
abydos/phonetic/_koelner.py
def _to_alpha(self, num): """Convert a Kölner Phonetik code from numeric to alphabetic. Parameters ---------- num : str or int A numeric Kölner Phonetik representation Returns ------- str An alphabetic representation of the same word ...
def _to_alpha(self, num): """Convert a Kölner Phonetik code from numeric to alphabetic. Parameters ---------- num : str or int A numeric Kölner Phonetik representation Returns ------- str An alphabetic representation of the same word ...
[ "Convert", "a", "Kölner", "Phonetik", "code", "from", "numeric", "to", "alphabetic", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_koelner.py#L199-L224
[ "def", "_to_alpha", "(", "self", ",", "num", ")", ":", "num", "=", "''", ".", "join", "(", "c", "for", "c", "in", "text_type", "(", "num", ")", "if", "c", "in", "self", ".", "_num_set", ")", "return", "num", ".", "translate", "(", "self", ".", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
main
Read input file and write to output. Parameters ---------- argv : list Arguments to the script
data/features/features_csv_to_dict.py
def main(argv): """Read input file and write to output. Parameters ---------- argv : list Arguments to the script """ first_col = 3 last_col = -1 def print_usage(): """Print usage statement.""" sys.stdout.write( 'features_csv_to_dict.py -i <inputfil...
def main(argv): """Read input file and write to output. Parameters ---------- argv : list Arguments to the script """ first_col = 3 last_col = -1 def print_usage(): """Print usage statement.""" sys.stdout.write( 'features_csv_to_dict.py -i <inputfil...
[ "Read", "input", "file", "and", "write", "to", "output", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/data/features/features_csv_to_dict.py#L54-L337
[ "def", "main", "(", "argv", ")", ":", "first_col", "=", "3", "last_col", "=", "-", "1", "def", "print_usage", "(", ")", ":", "\"\"\"Print usage statement.\"\"\"", "sys", ".", "stdout", ".", "write", "(", "'features_csv_to_dict.py -i <inputfile> '", "+", "'[-o <o...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
lein
Return the Lein code for a word. This is a wrapper for :py:meth:`Lein.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 a ma...
abydos/phonetic/_lein.py
def lein(word, max_length=4, zero_pad=True): """Return the Lein code for a word. This is a wrapper for :py:meth:`Lein.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) zero_pad : bool Pad...
def lein(word, max_length=4, zero_pad=True): """Return the Lein code for a word. This is a wrapper for :py:meth:`Lein.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) zero_pad : bool Pad...
[ "Return", "the", "Lein", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_lein.py#L99-L130
[ "def", "lein", "(", "word", ",", "max_length", "=", "4", ",", "zero_pad", "=", "True", ")", ":", "return", "Lein", "(", ")", ".", "encode", "(", "word", ",", "max_length", ",", "zero_pad", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Lein.encode
Return the Lein 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/_lein.py
def encode(self, word, max_length=4, zero_pad=True): """Return the Lein 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 en...
def encode(self, word, max_length=4, zero_pad=True): """Return the Lein 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 en...
[ "Return", "the", "Lein", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_lein.py#L52-L96
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "4", ",", "zero_pad", "=", "True", ")", ":", "# uppercase, normalize, decompose, and filter non-A-Z out", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upp...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
_TokenDistance._get_qgrams
Return the Q-Grams in src & tar. 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; 0 for non-q-gram...
abydos/distance/_token_distance.py
def _get_qgrams(self, src, tar, qval=0, skip=0): """Return the Q-Grams in src & tar. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/Counter objects) for comparison qval :...
def _get_qgrams(self, src, tar, qval=0, skip=0): """Return the Q-Grams in src & tar. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/Counter objects) for comparison qval :...
[ "Return", "the", "Q", "-", "Grams", "in", "src", "&", "tar", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_token_distance.py#L40-L72
[ "def", "_get_qgrams", "(", "self", ",", "src", ",", "tar", ",", "qval", "=", "0", ",", "skip", "=", "0", ")", ":", "if", "isinstance", "(", "src", ",", "Counter", ")", "and", "isinstance", "(", "tar", ",", "Counter", ")", ":", "return", "src", ",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
rle_encode
r"""Perform encoding of run-length-encoding (RLE). This is a wrapper for :py:meth:`RLE.encode`. Parameters ---------- text : str A text string to encode use_bwt : bool Indicates whether to perform BWT encoding before RLE encoding Returns ------- str Word decode...
abydos/compression/_rle.py
def rle_encode(text, use_bwt=True): r"""Perform encoding of run-length-encoding (RLE). This is a wrapper for :py:meth:`RLE.encode`. Parameters ---------- text : str A text string to encode use_bwt : bool Indicates whether to perform BWT encoding before RLE encoding Returns...
def rle_encode(text, use_bwt=True): r"""Perform encoding of run-length-encoding (RLE). This is a wrapper for :py:meth:`RLE.encode`. Parameters ---------- text : str A text string to encode use_bwt : bool Indicates whether to perform BWT encoding before RLE encoding Returns...
[ "r", "Perform", "encoding", "of", "run", "-", "length", "-", "encoding", "(", "RLE", ")", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_rle.py#L140-L177
[ "def", "rle_encode", "(", "text", ",", "use_bwt", "=", "True", ")", ":", "if", "use_bwt", ":", "text", "=", "BWT", "(", ")", ".", "encode", "(", "text", ")", "return", "RLE", "(", ")", ".", "encode", "(", "text", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
rle_decode
r"""Perform decoding of run-length-encoding (RLE). This is a wrapper for :py:meth:`RLE.decode`. Parameters ---------- text : str A text string to decode use_bwt : bool Indicates whether to perform BWT decoding after RLE decoding Returns ------- str Word decoded...
abydos/compression/_rle.py
def rle_decode(text, use_bwt=True): r"""Perform decoding of run-length-encoding (RLE). This is a wrapper for :py:meth:`RLE.decode`. Parameters ---------- text : str A text string to decode use_bwt : bool Indicates whether to perform BWT decoding after RLE decoding Returns ...
def rle_decode(text, use_bwt=True): r"""Perform decoding of run-length-encoding (RLE). This is a wrapper for :py:meth:`RLE.decode`. Parameters ---------- text : str A text string to decode use_bwt : bool Indicates whether to perform BWT decoding after RLE decoding Returns ...
[ "r", "Perform", "decoding", "of", "run", "-", "length", "-", "encoding", "(", "RLE", ")", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_rle.py#L180-L218
[ "def", "rle_decode", "(", "text", ",", "use_bwt", "=", "True", ")", ":", "text", "=", "RLE", "(", ")", ".", "decode", "(", "text", ")", "if", "use_bwt", ":", "text", "=", "BWT", "(", ")", ".", "decode", "(", "text", ")", "return", "text" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
RLE.encode
r"""Perform encoding of run-length-encoding (RLE). Parameters ---------- text : str A text string to encode Returns ------- str Word decoded by RLE Examples -------- >>> rle = RLE() >>> bwt = BWT() >>> rle...
abydos/compression/_rle.py
def encode(self, text): r"""Perform encoding of run-length-encoding (RLE). Parameters ---------- text : str A text string to encode Returns ------- str Word decoded by RLE Examples -------- >>> rle = RLE() ...
def encode(self, text): r"""Perform encoding of run-length-encoding (RLE). Parameters ---------- text : str A text string to encode Returns ------- str Word decoded by RLE Examples -------- >>> rle = RLE() ...
[ "r", "Perform", "encoding", "of", "run", "-", "length", "-", "encoding", "(", "RLE", ")", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_rle.py#L50-L89
[ "def", "encode", "(", "self", ",", "text", ")", ":", "if", "text", ":", "text", "=", "(", "(", "len", "(", "list", "(", "g", ")", ")", ",", "k", ")", "for", "k", ",", "g", "in", "groupby", "(", "text", ")", ")", "text", "=", "(", "(", "st...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
RLE.decode
r"""Perform decoding of run-length-encoding (RLE). Parameters ---------- text : str A text string to decode Returns ------- str Word decoded by RLE Examples -------- >>> rle = RLE() >>> bwt = BWT() >>> bwt...
abydos/compression/_rle.py
def decode(self, text): r"""Perform decoding of run-length-encoding (RLE). Parameters ---------- text : str A text string to decode Returns ------- str Word decoded by RLE Examples -------- >>> rle = RLE() ...
def decode(self, text): r"""Perform decoding of run-length-encoding (RLE). Parameters ---------- text : str A text string to decode Returns ------- str Word decoded by RLE Examples -------- >>> rle = RLE() ...
[ "r", "Perform", "decoding", "of", "run", "-", "length", "-", "encoding", "(", "RLE", ")", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_rle.py#L91-L137
[ "def", "decode", "(", "self", ",", "text", ")", ":", "mult", "=", "''", "decoded", "=", "[", "]", "for", "letter", "in", "list", "(", "text", ")", ":", "if", "not", "letter", ".", "isdigit", "(", ")", ":", "if", "mult", ":", "decoded", ".", "ap...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SoundD.encode
Return the SoundD code. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) Returns ------- str The SoundD code Examples -------- >>>...
abydos/phonetic/_sound_d.py
def encode(self, word, max_length=4): """Return the SoundD code. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) Returns ------- str The SoundD co...
def encode(self, word, max_length=4): """Return the SoundD code. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) Returns ------- str The SoundD co...
[ "Return", "the", "SoundD", "code", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_sound_d.py#L53-L107
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "4", ")", ":", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upper", "(", ")", ")", ")", "word", "=", "word", ".", "replace", "(", "'ß',", " ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NCDlzma.dist
Return the NCD between two strings using LZMA compression. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison Returns ------- float Compression distance Raises ...
abydos/distance/_ncd_lzma.py
def dist(self, src, tar): """Return the NCD between two strings using LZMA 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 LZMA compression. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison Returns ------- float Compress...
[ "Return", "the", "NCD", "between", "two", "strings", "using", "LZMA", "compression", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_ncd_lzma.py#L51-L103
[ "def", "dist", "(", "self", ",", "src", ",", "tar", ")", ":", "if", "src", "==", "tar", ":", "return", "0.0", "src", "=", "src", ".", "encode", "(", "'utf-8'", ")", "tar", "=", "tar", ".", "encode", "(", "'utf-8'", ")", "if", "lzma", "is", "not...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
smith_waterman
Return the Smith-Waterman score of two strings. This is a wrapper for :py:meth:`SmithWaterman.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison gap_cost : float The cost of an alignment gap (1 by default) ...
abydos/distance/_smith_waterman.py
def smith_waterman(src, tar, gap_cost=1, sim_func=sim_ident): """Return the Smith-Waterman score of two strings. This is a wrapper for :py:meth:`SmithWaterman.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison gap_...
def smith_waterman(src, tar, gap_cost=1, sim_func=sim_ident): """Return the Smith-Waterman score of two strings. This is a wrapper for :py:meth:`SmithWaterman.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison gap_...
[ "Return", "the", "Smith", "-", "Waterman", "score", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_smith_waterman.py#L98-L132
[ "def", "smith_waterman", "(", "src", ",", "tar", ",", "gap_cost", "=", "1", ",", "sim_func", "=", "sim_ident", ")", ":", "return", "SmithWaterman", "(", ")", ".", "dist_abs", "(", "src", ",", "tar", ",", "gap_cost", ",", "sim_func", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SmithWaterman.dist_abs
Return the Smith-Waterman score of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison gap_cost : float The cost of an alignment gap (1 by default) sim_func : function ...
abydos/distance/_smith_waterman.py
def dist_abs(self, src, tar, gap_cost=1, sim_func=sim_ident): """Return the Smith-Waterman score of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison gap_cost : float The c...
def dist_abs(self, src, tar, gap_cost=1, sim_func=sim_ident): """Return the Smith-Waterman score of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison gap_cost : float The c...
[ "Return", "the", "Smith", "-", "Waterman", "score", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_smith_waterman.py#L50-L95
[ "def", "dist_abs", "(", "self", ",", "src", ",", "tar", ",", "gap_cost", "=", "1", ",", "sim_func", "=", "sim_ident", ")", ":", "d_mat", "=", "np_zeros", "(", "(", "len", "(", "src", ")", "+", "1", ",", "len", "(", "tar", ")", "+", "1", ")", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
levenshtein
Return the Levenshtein distance between two strings. This is a wrapper of :py:meth:`Levenshtein.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode : str Specifies a mode for computing the Levenshtein dista...
abydos/distance/_levenshtein.py
def levenshtein(src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the Levenshtein distance between two strings. This is a wrapper of :py:meth:`Levenshtein.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode :...
def levenshtein(src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the Levenshtein distance between two strings. This is a wrapper of :py:meth:`Levenshtein.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode :...
[ "Return", "the", "Levenshtein", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_levenshtein.py#L206-L253
[ "def", "levenshtein", "(", "src", ",", "tar", ",", "mode", "=", "'lev'", ",", "cost", "=", "(", "1", ",", "1", ",", "1", ",", "1", ")", ")", ":", "return", "Levenshtein", "(", ")", ".", "dist_abs", "(", "src", ",", "tar", ",", "mode", ",", "c...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_levenshtein
Return the normalized Levenshtein distance between two strings. This is a wrapper of :py:meth:`Levenshtein.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode : str Specifies a mode for computing the Levenshtei...
abydos/distance/_levenshtein.py
def dist_levenshtein(src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the normalized Levenshtein distance between two strings. This is a wrapper of :py:meth:`Levenshtein.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for compariso...
def dist_levenshtein(src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the normalized Levenshtein distance between two strings. This is a wrapper of :py:meth:`Levenshtein.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for compariso...
[ "Return", "the", "normalized", "Levenshtein", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_levenshtein.py#L256-L298
[ "def", "dist_levenshtein", "(", "src", ",", "tar", ",", "mode", "=", "'lev'", ",", "cost", "=", "(", "1", ",", "1", ",", "1", ",", "1", ")", ")", ":", "return", "Levenshtein", "(", ")", ".", "dist", "(", "src", ",", "tar", ",", "mode", ",", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_levenshtein
Return the Levenshtein similarity of two strings. This is a wrapper of :py:meth:`Levenshtein.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode : str Specifies a mode for computing the Levenshtein distance: ...
abydos/distance/_levenshtein.py
def sim_levenshtein(src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the Levenshtein similarity of two strings. This is a wrapper of :py:meth:`Levenshtein.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode : str...
def sim_levenshtein(src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the Levenshtein similarity of two strings. This is a wrapper of :py:meth:`Levenshtein.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode : str...
[ "Return", "the", "Levenshtein", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_levenshtein.py#L301-L343
[ "def", "sim_levenshtein", "(", "src", ",", "tar", ",", "mode", "=", "'lev'", ",", "cost", "=", "(", "1", ",", "1", ",", "1", ",", "1", ")", ")", ":", "return", "Levenshtein", "(", ")", ".", "sim", "(", "src", ",", "tar", ",", "mode", ",", "co...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Levenshtein.dist_abs
Return the Levenshtein distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode : str Specifies a mode for computing the Levenshtein distance: - ``l...
abydos/distance/_levenshtein.py
def dist_abs(self, src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the Levenshtein distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode : str Specifi...
def dist_abs(self, src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the Levenshtein distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison mode : str Specifi...
[ "Return", "the", "Levenshtein", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_levenshtein.py#L63-L147
[ "def", "dist_abs", "(", "self", ",", "src", ",", "tar", ",", "mode", "=", "'lev'", ",", "cost", "=", "(", "1", ",", "1", ",", "1", ",", "1", ")", ")", ":", "ins_cost", ",", "del_cost", ",", "sub_cost", ",", "trans_cost", "=", "cost", "if", "src...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Levenshtein.dist
Return the normalized Levenshtein distance between two strings. The Levenshtein distance is normalized by dividing the Levenshtein 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 c...
abydos/distance/_levenshtein.py
def dist(self, src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the normalized Levenshtein distance between two strings. The Levenshtein distance is normalized by dividing the Levenshtein distance (calculated by any of the three supported methods) by the greater of the number of char...
def dist(self, src, tar, mode='lev', cost=(1, 1, 1, 1)): """Return the normalized Levenshtein distance between two strings. The Levenshtein distance is normalized by dividing the Levenshtein distance (calculated by any of the three supported methods) by the greater of the number of char...
[ "Return", "the", "normalized", "Levenshtein", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_levenshtein.py#L149-L203
[ "def", "dist", "(", "self", ",", "src", ",", "tar", ",", "mode", "=", "'lev'", ",", "cost", "=", "(", "1", ",", "1", ",", "1", ",", "1", ")", ")", ":", "if", "src", "==", "tar", ":", "return", "0", "ins_cost", ",", "del_cost", "=", "cost", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
OmissionKey.fingerprint
Return the omission key. Parameters ---------- word : str The word to transform into its omission key Returns ------- str The omission key Examples -------- >>> ok = OmissionKey() >>> ok.fingerprint('The quick bro...
abydos/fingerprint/_omission_key.py
def fingerprint(self, word): """Return the omission key. Parameters ---------- word : str The word to transform into its omission key Returns ------- str The omission key Examples -------- >>> ok = OmissionKey() ...
def fingerprint(self, word): """Return the omission key. Parameters ---------- word : str The word to transform into its omission key Returns ------- str The omission key Examples -------- >>> ok = OmissionKey() ...
[ "Return", "the", "omission", "key", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_omission_key.py#L49-L88
[ "def", "fingerprint", "(", "self", ",", "word", ")", ":", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upper", "(", ")", ")", ")", "word", "=", "''", ".", "join", "(", "c", "for", "c", "in", "word", "if", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
minkowski
Return the Minkowski distance (:math:`L^p`-norm) of two strings. This is a wrapper for :py:meth:`Minkowski.dist_abs`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/Counter objects) for comparison qval...
abydos/distance/_minkowski.py
def minkowski(src, tar, qval=2, pval=1, normalized=False, alphabet=None): """Return the Minkowski distance (:math:`L^p`-norm) of two strings. This is a wrapper for :py:meth:`Minkowski.dist_abs`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison ta...
def minkowski(src, tar, qval=2, pval=1, normalized=False, alphabet=None): """Return the Minkowski distance (:math:`L^p`-norm) of two strings. This is a wrapper for :py:meth:`Minkowski.dist_abs`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison ta...
[ "Return", "the", "Minkowski", "distance", "(", ":", "math", ":", "L^p", "-", "norm", ")", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_minkowski.py#L149-L186
[ "def", "minkowski", "(", "src", ",", "tar", ",", "qval", "=", "2", ",", "pval", "=", "1", ",", "normalized", "=", "False", ",", "alphabet", "=", "None", ")", ":", "return", "Minkowski", "(", ")", ".", "dist_abs", "(", "src", ",", "tar", ",", "qva...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_minkowski
Return normalized Minkowski distance of two strings. This is a wrapper for :py:meth:`Minkowski.dist`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/Counter objects) for comparison qval : int T...
abydos/distance/_minkowski.py
def dist_minkowski(src, tar, qval=2, pval=1, alphabet=None): """Return normalized Minkowski distance of two strings. This is a wrapper for :py:meth:`Minkowski.dist`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string...
def dist_minkowski(src, tar, qval=2, pval=1, alphabet=None): """Return normalized Minkowski distance of two strings. This is a wrapper for :py:meth:`Minkowski.dist`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string...
[ "Return", "normalized", "Minkowski", "distance", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_minkowski.py#L189-L224
[ "def", "dist_minkowski", "(", "src", ",", "tar", ",", "qval", "=", "2", ",", "pval", "=", "1", ",", "alphabet", "=", "None", ")", ":", "return", "Minkowski", "(", ")", ".", "dist", "(", "src", ",", "tar", ",", "qval", ",", "pval", ",", "alphabet"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_minkowski
Return normalized Minkowski similarity of two strings. This is a wrapper for :py:meth:`Minkowski.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/_minkowski.py
def sim_minkowski(src, tar, qval=2, pval=1, alphabet=None): """Return normalized Minkowski similarity of two strings. This is a wrapper for :py:meth:`Minkowski.sim`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string...
def sim_minkowski(src, tar, qval=2, pval=1, alphabet=None): """Return normalized Minkowski similarity of two strings. This is a wrapper for :py:meth:`Minkowski.sim`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string...
[ "Return", "normalized", "Minkowski", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_minkowski.py#L227-L262
[ "def", "sim_minkowski", "(", "src", ",", "tar", ",", "qval", "=", "2", ",", "pval", "=", "1", ",", "alphabet", "=", "None", ")", ":", "return", "Minkowski", "(", ")", ".", "sim", "(", "src", ",", "tar", ",", "qval", ",", "pval", ",", "alphabet", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Minkowski.dist_abs
Return the Minkowski distance (:math:`L^p`-norm) 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 ...
abydos/distance/_minkowski.py
def dist_abs( self, src, tar, qval=2, pval=1, normalized=False, alphabet=None ): """Return the Minkowski distance (:math:`L^p`-norm) of two strings. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str ...
def dist_abs( self, src, tar, qval=2, pval=1, normalized=False, alphabet=None ): """Return the Minkowski distance (:math:`L^p`-norm) of two strings. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str ...
[ "Return", "the", "Minkowski", "distance", "(", ":", "math", ":", "L^p", "-", "norm", ")", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_minkowski.py#L45-L107
[ "def", "dist_abs", "(", "self", ",", "src", ",", "tar", ",", "qval", "=", "2", ",", "pval", "=", "1", ",", "normalized", "=", "False", ",", "alphabet", "=", "None", ")", ":", "q_src", ",", "q_tar", "=", "self", ".", "_get_qgrams", "(", "src", ","...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Minkowski.dist
Return normalized Minkowski distance of two strings. The normalized Minkowski distance :cite:`Minkowski:1910` is a distance metric in :math:`L^p`-space, normalized to [0, 1]. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison ...
abydos/distance/_minkowski.py
def dist(self, src, tar, qval=2, pval=1, alphabet=None): """Return normalized Minkowski distance of two strings. The normalized Minkowski distance :cite:`Minkowski:1910` is a distance metric in :math:`L^p`-space, normalized to [0, 1]. Parameters ---------- src : str ...
def dist(self, src, tar, qval=2, pval=1, alphabet=None): """Return normalized Minkowski distance of two strings. The normalized Minkowski distance :cite:`Minkowski:1910` is a distance metric in :math:`L^p`-space, normalized to [0, 1]. Parameters ---------- src : str ...
[ "Return", "normalized", "Minkowski", "distance", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_minkowski.py#L109-L146
[ "def", "dist", "(", "self", ",", "src", ",", "tar", ",", "qval", "=", "2", ",", "pval", "=", "1", ",", "alphabet", "=", "None", ")", ":", "return", "self", ".", "dist_abs", "(", "src", ",", "tar", ",", "qval", ",", "pval", ",", "True", ",", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
occurrence_halved_fingerprint
Return the occurrence halved fingerprint. This is a wrapper for :py:meth:`OccurrenceHalved.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 tar...
abydos/fingerprint/_occurrence_halved.py
def occurrence_halved_fingerprint( word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG ): """Return the occurrence halved fingerprint. This is a wrapper for :py:meth:`OccurrenceHalved.fingerprint`. Parameters ---------- word : str The word to fingerprint n_bits : int Number...
def occurrence_halved_fingerprint( word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG ): """Return the occurrence halved fingerprint. This is a wrapper for :py:meth:`OccurrenceHalved.fingerprint`. Parameters ---------- word : str The word to fingerprint n_bits : int Number...
[ "Return", "the", "occurrence", "halved", "fingerprint", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_occurrence_halved.py#L102-L137
[ "def", "occurrence_halved_fingerprint", "(", "word", ",", "n_bits", "=", "16", ",", "most_common", "=", "MOST_COMMON_LETTERS_CG", ")", ":", "return", "OccurrenceHalved", "(", ")", ".", "fingerprint", "(", "word", ",", "n_bits", ",", "most_common", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
OccurrenceHalved.fingerprint
Return the occurrence halved fingerprint. Based on the occurrence halved fingerprint from :cite:`Cislak:2017`. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned most_common : list ...
abydos/fingerprint/_occurrence_halved.py
def fingerprint(self, word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG): """Return the occurrence halved fingerprint. Based on the occurrence halved fingerprint from :cite:`Cislak:2017`. Parameters ---------- word : str The word to fingerprint n_bits : in...
def fingerprint(self, word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG): """Return the occurrence halved fingerprint. Based on the occurrence halved fingerprint from :cite:`Cislak:2017`. Parameters ---------- word : str The word to fingerprint n_bits : in...
[ "Return", "the", "occurrence", "halved", "fingerprint", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_occurrence_halved.py#L42-L99
[ "def", "fingerprint", "(", "self", ",", "word", ",", "n_bits", "=", "16", ",", "most_common", "=", "MOST_COMMON_LETTERS_CG", ")", ":", "if", "n_bits", "%", "2", ":", "n_bits", "+=", "1", "w_len", "=", "len", "(", "word", ")", "//", "2", "w_1", "=", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
HenryEarly.encode
Calculate the early version of the Henry code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 3) Returns ------- str The early Henry code ...
abydos/phonetic/_henry_early.py
def encode(self, word, max_length=3): """Calculate the early version of the Henry code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 3) Returns ------- ...
def encode(self, word, max_length=3): """Calculate the early version of the Henry code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 3) Returns ------- ...
[ "Calculate", "the", "early", "version", "of", "the", "Henry", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_henry_early.py#L59-L239
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "3", ")", ":", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upper", "(", ")", ")", ")", "word", "=", "''", ".", "join", "(", "c", "for", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
pshp_soundex_first
Calculate the PSHP Soundex/Viewex Coding of a first name. This is a wrapper for :py:meth:`PSHPSoundexFirst.encode`. Parameters ---------- fname : str The first name to encode max_length : int The length of the code returned (defaults to 4) german : bool Set to True if t...
abydos/phonetic/_pshp_soundex_first.py
def pshp_soundex_first(fname, max_length=4, german=False): """Calculate the PSHP Soundex/Viewex Coding of a first name. This is a wrapper for :py:meth:`PSHPSoundexFirst.encode`. Parameters ---------- fname : str The first name to encode max_length : int The length of the code r...
def pshp_soundex_first(fname, max_length=4, german=False): """Calculate the PSHP Soundex/Viewex Coding of a first name. This is a wrapper for :py:meth:`PSHPSoundexFirst.encode`. Parameters ---------- fname : str The first name to encode max_length : int The length of the code r...
[ "Calculate", "the", "PSHP", "Soundex", "/", "Viewex", "Coding", "of", "a", "first", "name", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_pshp_soundex_first.py#L157-L200
[ "def", "pshp_soundex_first", "(", "fname", ",", "max_length", "=", "4", ",", "german", "=", "False", ")", ":", "return", "PSHPSoundexFirst", "(", ")", ".", "encode", "(", "fname", ",", "max_length", ",", "german", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
PSHPSoundexFirst.encode
Calculate the PSHP Soundex/Viewex Coding of a first name. Parameters ---------- fname : str The first name to encode max_length : int The length of the code returned (defaults to 4) german : bool Set to True if the name is German (different ru...
abydos/phonetic/_pshp_soundex_first.py
def encode(self, fname, max_length=4, german=False): """Calculate the PSHP Soundex/Viewex Coding of a first name. Parameters ---------- fname : str The first name to encode max_length : int The length of the code returned (defaults to 4) german : ...
def encode(self, fname, max_length=4, german=False): """Calculate the PSHP Soundex/Viewex Coding of a first name. Parameters ---------- fname : str The first name to encode max_length : int The length of the code returned (defaults to 4) german : ...
[ "Calculate", "the", "PSHP", "Soundex", "/", "Viewex", "Coding", "of", "a", "first", "name", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_pshp_soundex_first.py#L58-L154
[ "def", "encode", "(", "self", ",", "fname", ",", "max_length", "=", "4", ",", "german", "=", "False", ")", ":", "fname", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "fname", ".", "upper", "(", ")", ")", ")", "fname", "=", "fname",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
c2u
Convert camelCase (used in PHP) to Python-standard snake_case. Src: https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case Parameters ---------- name: A function or variable name in camelCase Returns ------- str: The name in snake_case
helpers/bm_php2py.py
def c2u(name): """Convert camelCase (used in PHP) to Python-standard snake_case. Src: https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case Parameters ---------- name: A function or variable name in camelCase Returns ------- str: Th...
def c2u(name): """Convert camelCase (used in PHP) to Python-standard snake_case. Src: https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case Parameters ---------- name: A function or variable name in camelCase Returns ------- str: Th...
[ "Convert", "camelCase", "(", "used", "in", "PHP", ")", "to", "Python", "-", "standard", "snake_case", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/helpers/bm_php2py.py#L89-L106
[ "def", "c2u", "(", "name", ")", ":", "s1", "=", "re", ".", "sub", "(", "'(.)([A-Z][a-z]+)'", ",", "r'\\1_\\2'", ",", "name", ")", "s1", "=", "re", ".", "sub", "(", "'([a-z0-9])([A-Z])'", ",", "r'\\1_\\2'", ",", "s1", ")", ".", "lower", "(", ")", "r...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
pythonize
Convert a line of BMPM code from PHP to Python. Parameters ---------- line : str A line of code fn : str A filename subdir : str The file's subdirectory Returns ------- The code in Python
helpers/bm_php2py.py
def pythonize(line, fn='', subdir='gen'): """Convert a line of BMPM code from PHP to Python. Parameters ---------- line : str A line of code fn : str A filename subdir : str The file's subdirectory Returns ------- The code in Python """ glob...
def pythonize(line, fn='', subdir='gen'): """Convert a line of BMPM code from PHP to Python. Parameters ---------- line : str A line of code fn : str A filename subdir : str The file's subdirectory Returns ------- The code in Python """ glob...
[ "Convert", "a", "line", "of", "BMPM", "code", "from", "PHP", "to", "Python", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/helpers/bm_php2py.py#L109-L297
[ "def", "pythonize", "(", "line", ",", "fn", "=", "''", ",", "subdir", "=", "'gen'", ")", ":", "global", "array_seen", ",", "nl", ",", "sd", "if", "'$all'", "in", "line", ":", "return", "''", "if", "'make the sum of all languages be visible in the function'", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Cosine.sim
r"""Return the cosine 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/_cosine.py
def sim(self, src, tar, qval=2): r"""Return the cosine 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 : in...
def sim(self, src, tar, qval=2): r"""Return the cosine 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 : in...
[ "r", "Return", "the", "cosine", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_cosine.py#L46-L86
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ",", "qval", "=", "2", ")", ":", "if", "src", "==", "tar", ":", "return", "1.0", "if", "not", "src", "or", "not", "tar", ":", "return", "0.0", "q_src", ",", "q_tar", "=", "self", ".", "_get_qgr...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_monge_elkan
Return the Monge-Elkan similarity of two strings. This is a wrapper for :py:meth:`MongeElkan.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison sim_func : function Rhe internal similarity metric to employ symmet...
abydos/distance/_monge_elkan.py
def sim_monge_elkan(src, tar, sim_func=sim_levenshtein, symmetric=False): """Return the Monge-Elkan similarity of two strings. This is a wrapper for :py:meth:`MongeElkan.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison ...
def sim_monge_elkan(src, tar, sim_func=sim_levenshtein, symmetric=False): """Return the Monge-Elkan similarity of two strings. This is a wrapper for :py:meth:`MongeElkan.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison ...
[ "Return", "the", "Monge", "-", "Elkan", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_monge_elkan.py#L106-L139
[ "def", "sim_monge_elkan", "(", "src", ",", "tar", ",", "sim_func", "=", "sim_levenshtein", ",", "symmetric", "=", "False", ")", ":", "return", "MongeElkan", "(", ")", ".", "sim", "(", "src", ",", "tar", ",", "sim_func", ",", "symmetric", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_monge_elkan
Return the Monge-Elkan distance between two strings. This is a wrapper for :py:meth:`MongeElkan.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison sim_func : function The internal similarity metric to employ sy...
abydos/distance/_monge_elkan.py
def dist_monge_elkan(src, tar, sim_func=sim_levenshtein, symmetric=False): """Return the Monge-Elkan distance between two strings. This is a wrapper for :py:meth:`MongeElkan.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparis...
def dist_monge_elkan(src, tar, sim_func=sim_levenshtein, symmetric=False): """Return the Monge-Elkan distance between two strings. This is a wrapper for :py:meth:`MongeElkan.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparis...
[ "Return", "the", "Monge", "-", "Elkan", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_monge_elkan.py#L142-L175
[ "def", "dist_monge_elkan", "(", "src", ",", "tar", ",", "sim_func", "=", "sim_levenshtein", ",", "symmetric", "=", "False", ")", ":", "return", "MongeElkan", "(", ")", ".", "dist", "(", "src", ",", "tar", ",", "sim_func", ",", "symmetric", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
MongeElkan.sim
Return the Monge-Elkan similarity of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison sim_func : function The internal similarity metric to employ symmetric : bool ...
abydos/distance/_monge_elkan.py
def sim(self, src, tar, sim_func=sim_levenshtein, symmetric=False): """Return the Monge-Elkan similarity of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison sim_func : function ...
def sim(self, src, tar, sim_func=sim_levenshtein, symmetric=False): """Return the Monge-Elkan similarity of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison sim_func : function ...
[ "Return", "the", "Monge", "-", "Elkan", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_monge_elkan.py#L51-L103
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ",", "sim_func", "=", "sim_levenshtein", ",", "symmetric", "=", "False", ")", ":", "if", "src", "==", "tar", ":", "return", "1.0", "q_src", "=", "sorted", "(", "QGrams", "(", "src", ")", ".", "elem...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Phonem.encode
Return the Phonem code for a word. Parameters ---------- word : str The word to transform Returns ------- str The Phonem value Examples -------- >>> pe = Phonem() >>> pe.encode('Christopher') 'CRYSDOVR' ...
abydos/phonetic/_phonem.py
def encode(self, word): """Return the Phonem code for a word. Parameters ---------- word : str The word to transform Returns ------- str The Phonem value Examples -------- >>> pe = Phonem() >>> pe.encode('Chri...
def encode(self, word): """Return the Phonem code for a word. Parameters ---------- word : str The word to transform Returns ------- str The Phonem value Examples -------- >>> pe = Phonem() >>> pe.encode('Chri...
[ "Return", "the", "Phonem", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_phonem.py#L82-L117
[ "def", "encode", "(", "self", ",", "word", ")", ":", "word", "=", "unicode_normalize", "(", "'NFC'", ",", "text_type", "(", "word", ".", "upper", "(", ")", ")", ")", "for", "i", ",", "j", "in", "self", ".", "_substitutions", ":", "word", "=", "word...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
CLEFSwedish.stem
Return CLEF Swedish stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> clef_swedish('undervisa') 'undervis' >>> clef_swedish('suspension') '...
abydos/stemmer/_clef_swedish.py
def stem(self, word): """Return CLEF Swedish stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> clef_swedish('undervisa') 'undervis' >>> cle...
def stem(self, word): """Return CLEF Swedish stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> clef_swedish('undervisa') 'undervis' >>> cle...
[ "Return", "CLEF", "Swedish", "stem", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_clef_swedish.py#L42-L82
[ "def", "stem", "(", "self", ",", "word", ")", ":", "wlen", "=", "len", "(", "word", ")", "-", "2", "if", "wlen", ">", "2", "and", "word", "[", "-", "1", "]", "==", "'s'", ":", "word", "=", "word", "[", ":", "-", "1", "]", "wlen", "-=", "1...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SnowballDutch._undouble
Undouble endings -kk, -dd, and -tt. Parameters ---------- word : str The word to stem Returns ------- str The word with doubled endings undoubled
abydos/stemmer/_snowball_dutch.py
def _undouble(self, word): """Undouble endings -kk, -dd, and -tt. Parameters ---------- word : str The word to stem Returns ------- str The word with doubled endings undoubled """ if ( len(word) > 1 ...
def _undouble(self, word): """Undouble endings -kk, -dd, and -tt. Parameters ---------- word : str The word to stem Returns ------- str The word with doubled endings undoubled """ if ( len(word) > 1 ...
[ "Undouble", "endings", "-", "kk", "-", "dd", "and", "-", "tt", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball_dutch.py#L52-L72
[ "def", "_undouble", "(", "self", ",", "word", ")", ":", "if", "(", "len", "(", "word", ")", ">", "1", "and", "word", "[", "-", "1", "]", "==", "word", "[", "-", "2", "]", "and", "word", "[", "-", "1", "]", "in", "{", "'d'", ",", "'k'", ",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SnowballDutch.stem
Return Snowball Dutch stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = SnowballDutch() >>> stmr.stem('lezen') 'lez' >>> stmr.stem('...
abydos/stemmer/_snowball_dutch.py
def stem(self, word): """Return Snowball Dutch stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = SnowballDutch() >>> stmr.stem('lezen') ...
def stem(self, word): """Return Snowball Dutch stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = SnowballDutch() >>> stmr.stem('lezen') ...
[ "Return", "Snowball", "Dutch", "stem", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball_dutch.py#L74-L213
[ "def", "stem", "(", "self", ",", "word", ")", ":", "# lowercase, normalize, decompose, filter umlauts & acutes out, and", "# compose", "word", "=", "normalize", "(", "'NFC'", ",", "text_type", "(", "word", ".", "lower", "(", ")", ")", ")", "word", "=", "word", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
soundex
Return the Soundex code for a word. This is a wrapper for :py:meth:`Soundex.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) var : str The variant of the algorithm to employ (defaults to ``A...
abydos/phonetic/_soundex.py
def soundex(word, max_length=4, var='American', reverse=False, zero_pad=True): """Return the Soundex code for a word. This is a wrapper for :py:meth:`Soundex.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaul...
def soundex(word, max_length=4, var='American', reverse=False, zero_pad=True): """Return the Soundex code for a word. This is a wrapper for :py:meth:`Soundex.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaul...
[ "Return", "the", "Soundex", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_soundex.py#L190-L255
[ "def", "soundex", "(", "word", ",", "max_length", "=", "4", ",", "var", "=", "'American'", ",", "reverse", "=", "False", ",", "zero_pad", "=", "True", ")", ":", "return", "Soundex", "(", ")", ".", "encode", "(", "word", ",", "max_length", ",", "var",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Soundex.encode
Return the Soundex code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) var : str The variant of the algorithm to employ (defaults to ``American``): ...
abydos/phonetic/_soundex.py
def encode( self, word, max_length=4, var='American', reverse=False, zero_pad=True ): """Return the Soundex code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4...
def encode( self, word, max_length=4, var='American', reverse=False, zero_pad=True ): """Return the Soundex code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4...
[ "Return", "the", "Soundex", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_soundex.py#L63-L187
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "4", ",", "var", "=", "'American'", ",", "reverse", "=", "False", ",", "zero_pad", "=", "True", ")", ":", "# Require a max_length of at least 4 and not more than 64", "if", "max_length", "!=", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
String.fingerprint
Return string fingerprint. Parameters ---------- phrase : str The string from which to calculate the fingerprint joiner : str The string that will be placed between each word Returns ------- str The fingerprint of the phrase ...
abydos/fingerprint/_string.py
def fingerprint(self, phrase, joiner=' '): """Return string fingerprint. Parameters ---------- phrase : str The string from which to calculate the fingerprint joiner : str The string that will be placed between each word Returns ------- ...
def fingerprint(self, phrase, joiner=' '): """Return string fingerprint. Parameters ---------- phrase : str The string from which to calculate the fingerprint joiner : str The string that will be placed between each word Returns ------- ...
[ "Return", "string", "fingerprint", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_string.py#L48-L73
[ "def", "fingerprint", "(", "self", ",", "phrase", ",", "joiner", "=", "' '", ")", ":", "phrase", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "phrase", ".", "strip", "(", ")", ".", "lower", "(", ")", ")", ")", "phrase", "=", "''", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
RussellIndex.encode
Return the Russell Index (integer output) of a word. Parameters ---------- word : str The word to transform Returns ------- int The Russell Index value Examples -------- >>> pe = RussellIndex() >>> pe.encode('Chri...
abydos/phonetic/_russell_index.py
def encode(self, word): """Return the Russell Index (integer output) of a word. Parameters ---------- word : str The word to transform Returns ------- int The Russell Index value Examples -------- >>> pe = Russell...
def encode(self, word): """Return the Russell Index (integer output) of a word. Parameters ---------- word : str The word to transform Returns ------- int The Russell Index value Examples -------- >>> pe = Russell...
[ "Return", "the", "Russell", "Index", "(", "integer", "output", ")", "of", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_russell_index.py#L64-L108
[ "def", "encode", "(", "self", ",", "word", ")", ":", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upper", "(", ")", ")", ")", "word", "=", "word", ".", "replace", "(", "'ß',", " ", "SS')", "", "word", "=", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ipa_to_features
Convert IPA to features. This translates an IPA string of one or more phones to a list of ints representing the features of the string. Parameters ---------- ipa : str The IPA representation of a phone or series of phones Returns ------- list of ints A representation o...
abydos/phones/_phones.py
def ipa_to_features(ipa): """Convert IPA to features. This translates an IPA string of one or more phones to a list of ints representing the features of the string. Parameters ---------- ipa : str The IPA representation of a phone or series of phones Returns ------- list o...
def ipa_to_features(ipa): """Convert IPA to features. This translates an IPA string of one or more phones to a list of ints representing the features of the string. Parameters ---------- ipa : str The IPA representation of a phone or series of phones Returns ------- list o...
[ "Convert", "IPA", "to", "features", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phones/_phones.py#L586-L634
[ "def", "ipa_to_features", "(", "ipa", ")", ":", "features", "=", "[", "]", "pos", "=", "0", "ipa", "=", "normalize", "(", "'NFD'", ",", "text_type", "(", "ipa", ".", "lower", "(", ")", ")", ")", "maxsymlen", "=", "max", "(", "len", "(", "_", ")",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
get_feature
Get a feature vector. This returns a list of ints, equal in length to the vector input, representing presence/absence/neutrality with respect to a particular phonetic feature. Parameters ---------- vector : list A tuple or list of ints representing the phonetic features of a ph...
abydos/phones/_phones.py
def get_feature(vector, feature): """Get a feature vector. This returns a list of ints, equal in length to the vector input, representing presence/absence/neutrality with respect to a particular phonetic feature. Parameters ---------- vector : list A tuple or list of ints r...
def get_feature(vector, feature): """Get a feature vector. This returns a list of ints, equal in length to the vector input, representing presence/absence/neutrality with respect to a particular phonetic feature. Parameters ---------- vector : list A tuple or list of ints r...
[ "Get", "a", "feature", "vector", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phones/_phones.py#L637-L757
[ "def", "get_feature", "(", "vector", ",", "feature", ")", ":", "# :param bool binary: if False, -1, 0, & 1 represent -, 0, & +", "# if True, only binary oppositions are allowed:", "# 0 & 1 represent - & + and 0s are mapped to -", "if", "feature", "not", "in", "_FEAT...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
cmp_features
Compare features. This returns a number in the range [0, 1] representing a comparison of two feature bundles. If one of the bundles is negative, -1 is returned (for unknown values) If the bundles are identical, 1 is returned. If they are inverses of one another, 0 is returned. Otherwise, a ...
abydos/phones/_phones.py
def cmp_features(feat1, feat2): """Compare features. This returns a number in the range [0, 1] representing a comparison of two feature bundles. If one of the bundles is negative, -1 is returned (for unknown values) If the bundles are identical, 1 is returned. If they are inverses of one ano...
def cmp_features(feat1, feat2): """Compare features. This returns a number in the range [0, 1] representing a comparison of two feature bundles. If one of the bundles is negative, -1 is returned (for unknown values) If the bundles are identical, 1 is returned. If they are inverses of one ano...
[ "Compare", "features", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phones/_phones.py#L760-L812
[ "def", "cmp_features", "(", "feat1", ",", "feat2", ")", ":", "if", "feat1", "<", "0", "or", "feat2", "<", "0", ":", "return", "-", "1.0", "if", "feat1", "==", "feat2", ":", "return", "1.0", "magnitude", "=", "len", "(", "_FEATURE_MASK", ")", "featxor...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Length.sim
Return the length similarity of two strings. Length similarity is the ratio of the length of the shorter string to the longer. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison Returns ...
abydos/distance/_length.py
def sim(self, src, tar): """Return the length similarity of two strings. Length similarity is the ratio of the length of the shorter string to the longer. Parameters ---------- src : str Source string for comparison tar : str Target strin...
def sim(self, src, tar): """Return the length similarity of two strings. Length similarity is the ratio of the length of the shorter string to the longer. Parameters ---------- src : str Source string for comparison tar : str Target strin...
[ "Return", "the", "length", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_length.py#L39-L76
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ")", ":", "if", "src", "==", "tar", ":", "return", "1.0", "if", "not", "src", "or", "not", "tar", ":", "return", "0.0", "return", "(", "len", "(", "src", ")", "/", "len", "(", "tar", ")", "if...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Caverphone.encode
Return the Caverphone code for a word. Parameters ---------- word : str The word to transform version : int The version of Caverphone to employ for encoding (defaults to 2) Returns ------- str The Caverphone value Exa...
abydos/phonetic/_caverphone.py
def encode(self, word, version=2): """Return the Caverphone code for a word. Parameters ---------- word : str The word to transform version : int The version of Caverphone to employ for encoding (defaults to 2) Returns ------- str...
def encode(self, word, version=2): """Return the Caverphone code for a word. Parameters ---------- word : str The word to transform version : int The version of Caverphone to employ for encoding (defaults to 2) Returns ------- str...
[ "Return", "the", "Caverphone", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_caverphone.py#L46-L201
[ "def", "encode", "(", "self", ",", "word", ",", "version", "=", "2", ")", ":", "word", "=", "word", ".", "lower", "(", ")", "word", "=", "''", ".", "join", "(", "c", "for", "c", "in", "word", "if", "c", "in", "self", ".", "_lc_set", ")", "def...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
hmean
r"""Return harmonic mean. The harmonic mean is defined as: :math:`\frac{|nums|}{\sum\limits_{i}\frac{1}{nums_i}}` Following the behavior of Wolfram|Alpha: - If one of the values in nums is 0, return 0. - If more than one value in nums is 0, return NaN. Cf. https://en.wikipedia.org/wiki/Harmon...
abydos/stats/_mean.py
def hmean(nums): r"""Return harmonic mean. The harmonic mean is defined as: :math:`\frac{|nums|}{\sum\limits_{i}\frac{1}{nums_i}}` Following the behavior of Wolfram|Alpha: - If one of the values in nums is 0, return 0. - If more than one value in nums is 0, return NaN. Cf. https://en.wiki...
def hmean(nums): r"""Return harmonic mean. The harmonic mean is defined as: :math:`\frac{|nums|}{\sum\limits_{i}\frac{1}{nums_i}}` Following the behavior of Wolfram|Alpha: - If one of the values in nums is 0, return 0. - If more than one value in nums is 0, return NaN. Cf. https://en.wiki...
[ "r", "Return", "harmonic", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L124-L176
[ "def", "hmean", "(", "nums", ")", ":", "if", "len", "(", "nums", ")", "<", "1", ":", "raise", "AttributeError", "(", "'hmean requires at least one value'", ")", "elif", "len", "(", "nums", ")", "==", "1", ":", "return", "nums", "[", "0", "]", "else", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
lmean
r"""Return logarithmic mean. The logarithmic mean of an arbitrarily long series is defined by http://www.survo.fi/papers/logmean.pdf as: :math:`L(x_1, x_2, ..., x_n) = (n-1)! \sum\limits_{i=1}^n \frac{x_i} {\prod\limits_{\substack{j = 1\\j \ne i}}^n ln \frac{x_i}{x_j}}` Cf. https://en....
abydos/stats/_mean.py
def lmean(nums): r"""Return logarithmic mean. The logarithmic mean of an arbitrarily long series is defined by http://www.survo.fi/papers/logmean.pdf as: :math:`L(x_1, x_2, ..., x_n) = (n-1)! \sum\limits_{i=1}^n \frac{x_i} {\prod\limits_{\substack{j = 1\\j \ne i}}^n ln \frac{x_i}{x_j}}`...
def lmean(nums): r"""Return logarithmic mean. The logarithmic mean of an arbitrarily long series is defined by http://www.survo.fi/papers/logmean.pdf as: :math:`L(x_1, x_2, ..., x_n) = (n-1)! \sum\limits_{i=1}^n \frac{x_i} {\prod\limits_{\substack{j = 1\\j \ne i}}^n ln \frac{x_i}{x_j}}`...
[ "r", "Return", "logarithmic", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L241-L286
[ "def", "lmean", "(", "nums", ")", ":", "if", "len", "(", "nums", ")", "!=", "len", "(", "set", "(", "nums", ")", ")", ":", "raise", "AttributeError", "(", "'No two values in the nums list may be equal'", ")", "rolling_sum", "=", "0", "for", "i", "in", "r...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
imean
r"""Return identric (exponential) mean. The identric mean of two numbers x and y is: x if x = y otherwise :math:`\frac{1}{e} \sqrt[x-y]{\frac{x^x}{y^y}}` Cf. https://en.wikipedia.org/wiki/Identric_mean Parameters ---------- nums : list A series of numbers Returns ------- ...
abydos/stats/_mean.py
def imean(nums): r"""Return identric (exponential) mean. The identric mean of two numbers x and y is: x if x = y otherwise :math:`\frac{1}{e} \sqrt[x-y]{\frac{x^x}{y^y}}` Cf. https://en.wikipedia.org/wiki/Identric_mean Parameters ---------- nums : list A series of numbers ...
def imean(nums): r"""Return identric (exponential) mean. The identric mean of two numbers x and y is: x if x = y otherwise :math:`\frac{1}{e} \sqrt[x-y]{\frac{x^x}{y^y}}` Cf. https://en.wikipedia.org/wiki/Identric_mean Parameters ---------- nums : list A series of numbers ...
[ "r", "Return", "identric", "(", "exponential", ")", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L289-L333
[ "def", "imean", "(", "nums", ")", ":", "if", "len", "(", "nums", ")", "==", "1", ":", "return", "nums", "[", "0", "]", "if", "len", "(", "nums", ")", ">", "2", ":", "raise", "AttributeError", "(", "'imean supports no more than two values'", ")", "if", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
seiffert_mean
r"""Return Seiffert's mean. Seiffert's mean of two numbers x and y is: :math:`\frac{x - y}{4 \cdot arctan \sqrt{\frac{x}{y}} - \pi}` It is defined in :cite:`Seiffert:1993`. Parameters ---------- nums : list A series of numbers Returns ------- float Sieffert's mean...
abydos/stats/_mean.py
def seiffert_mean(nums): r"""Return Seiffert's mean. Seiffert's mean of two numbers x and y is: :math:`\frac{x - y}{4 \cdot arctan \sqrt{\frac{x}{y}} - \pi}` It is defined in :cite:`Seiffert:1993`. Parameters ---------- nums : list A series of numbers Returns ------- ...
def seiffert_mean(nums): r"""Return Seiffert's mean. Seiffert's mean of two numbers x and y is: :math:`\frac{x - y}{4 \cdot arctan \sqrt{\frac{x}{y}} - \pi}` It is defined in :cite:`Seiffert:1993`. Parameters ---------- nums : list A series of numbers Returns ------- ...
[ "r", "Return", "Seiffert", "s", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L336-L379
[ "def", "seiffert_mean", "(", "nums", ")", ":", "if", "len", "(", "nums", ")", "==", "1", ":", "return", "nums", "[", "0", "]", "if", "len", "(", "nums", ")", ">", "2", ":", "raise", "AttributeError", "(", "'seiffert_mean supports no more than two values'",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
lehmer_mean
r"""Return Lehmer mean. The Lehmer mean is: :math:`\frac{\sum\limits_i{x_i^p}}{\sum\limits_i{x_i^(p-1)}}` Cf. https://en.wikipedia.org/wiki/Lehmer_mean Parameters ---------- nums : list A series of numbers exp : numeric The exponent of the Lehmer mean Returns ----...
abydos/stats/_mean.py
def lehmer_mean(nums, exp=2): r"""Return Lehmer mean. The Lehmer mean is: :math:`\frac{\sum\limits_i{x_i^p}}{\sum\limits_i{x_i^(p-1)}}` Cf. https://en.wikipedia.org/wiki/Lehmer_mean Parameters ---------- nums : list A series of numbers exp : numeric The exponent of the...
def lehmer_mean(nums, exp=2): r"""Return Lehmer mean. The Lehmer mean is: :math:`\frac{\sum\limits_i{x_i^p}}{\sum\limits_i{x_i^(p-1)}}` Cf. https://en.wikipedia.org/wiki/Lehmer_mean Parameters ---------- nums : list A series of numbers exp : numeric The exponent of the...
[ "r", "Return", "Lehmer", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L382-L412
[ "def", "lehmer_mean", "(", "nums", ",", "exp", "=", "2", ")", ":", "return", "sum", "(", "x", "**", "exp", "for", "x", "in", "nums", ")", "/", "sum", "(", "x", "**", "(", "exp", "-", "1", ")", "for", "x", "in", "nums", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
heronian_mean
r"""Return Heronian mean. The Heronian mean is: :math:`\frac{\sum\limits_{i, j}\sqrt{{x_i \cdot x_j}}} {|nums| \cdot \frac{|nums| + 1}{2}}` for :math:`j \ge i` Cf. https://en.wikipedia.org/wiki/Heronian_mean Parameters ---------- nums : list A series of numbers Returns ...
abydos/stats/_mean.py
def heronian_mean(nums): r"""Return Heronian mean. The Heronian mean is: :math:`\frac{\sum\limits_{i, j}\sqrt{{x_i \cdot x_j}}} {|nums| \cdot \frac{|nums| + 1}{2}}` for :math:`j \ge i` Cf. https://en.wikipedia.org/wiki/Heronian_mean Parameters ---------- nums : list A seri...
def heronian_mean(nums): r"""Return Heronian mean. The Heronian mean is: :math:`\frac{\sum\limits_{i, j}\sqrt{{x_i \cdot x_j}}} {|nums| \cdot \frac{|nums| + 1}{2}}` for :math:`j \ge i` Cf. https://en.wikipedia.org/wiki/Heronian_mean Parameters ---------- nums : list A seri...
[ "r", "Return", "Heronian", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L415-L453
[ "def", "heronian_mean", "(", "nums", ")", ":", "mag", "=", "len", "(", "nums", ")", "rolling_sum", "=", "0", "for", "i", "in", "range", "(", "mag", ")", ":", "for", "j", "in", "range", "(", "i", ",", "mag", ")", ":", "if", "nums", "[", "i", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
hoelder_mean
r"""Return Hölder (power/generalized) mean. The Hölder mean is defined as: :math:`\sqrt[p]{\frac{1}{|nums|} \cdot \sum\limits_i{x_i^p}}` for :math:`p \ne 0`, and the geometric mean for :math:`p = 0` Cf. https://en.wikipedia.org/wiki/Generalized_mean Parameters ---------- nums : list ...
abydos/stats/_mean.py
def hoelder_mean(nums, exp=2): r"""Return Hölder (power/generalized) mean. The Hölder mean is defined as: :math:`\sqrt[p]{\frac{1}{|nums|} \cdot \sum\limits_i{x_i^p}}` for :math:`p \ne 0`, and the geometric mean for :math:`p = 0` Cf. https://en.wikipedia.org/wiki/Generalized_mean Parameters ...
def hoelder_mean(nums, exp=2): r"""Return Hölder (power/generalized) mean. The Hölder mean is defined as: :math:`\sqrt[p]{\frac{1}{|nums|} \cdot \sum\limits_i{x_i^p}}` for :math:`p \ne 0`, and the geometric mean for :math:`p = 0` Cf. https://en.wikipedia.org/wiki/Generalized_mean Parameters ...
[ "r", "Return", "Hölder", "(", "power", "/", "generalized", ")", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L456-L489
[ "def", "hoelder_mean", "(", "nums", ",", "exp", "=", "2", ")", ":", "if", "exp", "==", "0", ":", "return", "gmean", "(", "nums", ")", "return", "(", "(", "1", "/", "len", "(", "nums", ")", ")", "*", "sum", "(", "i", "**", "exp", "for", "i", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
agmean
Return arithmetic-geometric mean. Iterates between arithmetic & geometric means until they converge to a single value (rounded to 12 digits). Cf. https://en.wikipedia.org/wiki/Arithmetic-geometric_mean Parameters ---------- nums : list A series of numbers Returns ------- ...
abydos/stats/_mean.py
def agmean(nums): """Return arithmetic-geometric mean. Iterates between arithmetic & geometric means until they converge to a single value (rounded to 12 digits). Cf. https://en.wikipedia.org/wiki/Arithmetic-geometric_mean Parameters ---------- nums : list A series of numbers ...
def agmean(nums): """Return arithmetic-geometric mean. Iterates between arithmetic & geometric means until they converge to a single value (rounded to 12 digits). Cf. https://en.wikipedia.org/wiki/Arithmetic-geometric_mean Parameters ---------- nums : list A series of numbers ...
[ "Return", "arithmetic", "-", "geometric", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L492-L526
[ "def", "agmean", "(", "nums", ")", ":", "m_a", "=", "amean", "(", "nums", ")", "m_g", "=", "gmean", "(", "nums", ")", "if", "math", ".", "isnan", "(", "m_a", ")", "or", "math", ".", "isnan", "(", "m_g", ")", ":", "return", "float", "(", "'nan'"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ghmean
Return geometric-harmonic mean. Iterates between geometric & harmonic means until they converge to a single value (rounded to 12 digits). Cf. https://en.wikipedia.org/wiki/Geometric-harmonic_mean Parameters ---------- nums : list A series of numbers Returns ------- float ...
abydos/stats/_mean.py
def ghmean(nums): """Return geometric-harmonic mean. Iterates between geometric & harmonic means until they converge to a single value (rounded to 12 digits). Cf. https://en.wikipedia.org/wiki/Geometric-harmonic_mean Parameters ---------- nums : list A series of numbers Retur...
def ghmean(nums): """Return geometric-harmonic mean. Iterates between geometric & harmonic means until they converge to a single value (rounded to 12 digits). Cf. https://en.wikipedia.org/wiki/Geometric-harmonic_mean Parameters ---------- nums : list A series of numbers Retur...
[ "Return", "geometric", "-", "harmonic", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L529-L568
[ "def", "ghmean", "(", "nums", ")", ":", "m_g", "=", "gmean", "(", "nums", ")", "m_h", "=", "hmean", "(", "nums", ")", "if", "math", ".", "isnan", "(", "m_g", ")", "or", "math", ".", "isnan", "(", "m_h", ")", ":", "return", "float", "(", "'nan'"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
aghmean
Return arithmetic-geometric-harmonic mean. Iterates over arithmetic, geometric, & harmonic means until they converge to a single value (rounded to 12 digits), following the method described in :cite:`Raissouli:2009`. Parameters ---------- nums : list A series of numbers Returns ...
abydos/stats/_mean.py
def aghmean(nums): """Return arithmetic-geometric-harmonic mean. Iterates over arithmetic, geometric, & harmonic means until they converge to a single value (rounded to 12 digits), following the method described in :cite:`Raissouli:2009`. Parameters ---------- nums : list A series ...
def aghmean(nums): """Return arithmetic-geometric-harmonic mean. Iterates over arithmetic, geometric, & harmonic means until they converge to a single value (rounded to 12 digits), following the method described in :cite:`Raissouli:2009`. Parameters ---------- nums : list A series ...
[ "Return", "arithmetic", "-", "geometric", "-", "harmonic", "mean", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L571-L611
[ "def", "aghmean", "(", "nums", ")", ":", "m_a", "=", "amean", "(", "nums", ")", "m_g", "=", "gmean", "(", "nums", ")", "m_h", "=", "hmean", "(", "nums", ")", "if", "math", ".", "isnan", "(", "m_a", ")", "or", "math", ".", "isnan", "(", "m_g", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
median
Return median. With numbers sorted by value, the median is the middle value (if there is an odd number of values) or the arithmetic mean of the two middle values (if there is an even number of values). Cf. https://en.wikipedia.org/wiki/Median Parameters ---------- nums : list A se...
abydos/stats/_mean.py
def median(nums): """Return median. With numbers sorted by value, the median is the middle value (if there is an odd number of values) or the arithmetic mean of the two middle values (if there is an even number of values). Cf. https://en.wikipedia.org/wiki/Median Parameters ---------- ...
def median(nums): """Return median. With numbers sorted by value, the median is the middle value (if there is an odd number of values) or the arithmetic mean of the two middle values (if there is an even number of values). Cf. https://en.wikipedia.org/wiki/Median Parameters ---------- ...
[ "Return", "median", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L644-L680
[ "def", "median", "(", "nums", ")", ":", "nums", "=", "sorted", "(", "nums", ")", "mag", "=", "len", "(", "nums", ")", "if", "mag", "%", "2", ":", "mag", "=", "int", "(", "(", "mag", "-", "1", ")", "/", "2", ")", "return", "nums", "[", "mag"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
var
r"""Calculate the variance. The variance (:math:`\sigma^2`) of a series of numbers (:math:`x_i`) with mean :math:`\mu` and population :math:`N` is: :math:`\sigma^2 = \frac{1}{N}\sum_{i=1}^{N}(x_i-\mu)^2`. Cf. https://en.wikipedia.org/wiki/Variance Parameters ---------- nums : list ...
abydos/stats/_mean.py
def var(nums, mean_func=amean, ddof=0): r"""Calculate the variance. The variance (:math:`\sigma^2`) of a series of numbers (:math:`x_i`) with mean :math:`\mu` and population :math:`N` is: :math:`\sigma^2 = \frac{1}{N}\sum_{i=1}^{N}(x_i-\mu)^2`. Cf. https://en.wikipedia.org/wiki/Variance Para...
def var(nums, mean_func=amean, ddof=0): r"""Calculate the variance. The variance (:math:`\sigma^2`) of a series of numbers (:math:`x_i`) with mean :math:`\mu` and population :math:`N` is: :math:`\sigma^2 = \frac{1}{N}\sum_{i=1}^{N}(x_i-\mu)^2`. Cf. https://en.wikipedia.org/wiki/Variance Para...
[ "r", "Calculate", "the", "variance", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_mean.py#L709-L744
[ "def", "var", "(", "nums", ",", "mean_func", "=", "amean", ",", "ddof", "=", "0", ")", ":", "x_bar", "=", "mean_func", "(", "nums", ")", "return", "sum", "(", "(", "x", "-", "x_bar", ")", "**", "2", "for", "x", "in", "nums", ")", "/", "(", "l...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Schinke.stem
Return the stem of a word according to the Schinke stemmer. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = Schinke() >>> stmr.stem('atque') {'n...
abydos/stemmer/_schinke.py
def stem(self, word): """Return the stem of a word according to the Schinke stemmer. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = Schinke() >...
def stem(self, word): """Return the stem of a word according to the Schinke stemmer. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = Schinke() >...
[ "Return", "the", "stem", "of", "a", "word", "according", "to", "the", "Schinke", "stemmer", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_schinke.py#L141-L261
[ "def", "stem", "(", "self", ",", "word", ")", ":", "word", "=", "normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "lower", "(", ")", ")", ")", "word", "=", "''", ".", "join", "(", "c", "for", "c", "in", "word", "if", "c", "in", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
onca
Return the Oxford Name Compression Algorithm (ONCA) code for a word. This is a wrapper for :py:meth:`ONCA.encode`. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return zero_pad : bool Pad the end of...
abydos/phonetic/_onca.py
def onca(word, max_length=4, zero_pad=True): """Return the Oxford Name Compression Algorithm (ONCA) code for a word. This is a wrapper for :py:meth:`ONCA.encode`. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code ...
def onca(word, max_length=4, zero_pad=True): """Return the Oxford Name Compression Algorithm (ONCA) code for a word. This is a wrapper for :py:meth:`ONCA.encode`. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code ...
[ "Return", "the", "Oxford", "Name", "Compression", "Algorithm", "(", "ONCA", ")", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_onca.py#L93-L124
[ "def", "onca", "(", "word", ",", "max_length", "=", "4", ",", "zero_pad", "=", "True", ")", ":", "return", "ONCA", "(", ")", ".", "encode", "(", "word", ",", "max_length", ",", "zero_pad", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ONCA.encode
Return the Oxford Name Compression Algorithm (ONCA) code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return zero_pad : bool Pad the end of the return value w...
abydos/phonetic/_onca.py
def encode(self, word, max_length=4, zero_pad=True): """Return the Oxford Name Compression Algorithm (ONCA) code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return ...
def encode(self, word, max_length=4, zero_pad=True): """Return the Oxford Name Compression Algorithm (ONCA) code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length (default 5) of the code to return ...
[ "Return", "the", "Oxford", "Name", "Compression", "Algorithm", "(", "ONCA", ")", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_onca.py#L52-L90
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "4", ",", "zero_pad", "=", "True", ")", ":", "# In the most extreme case, 3 characters of NYSIIS input can be", "# compressed to one character of output, so give it triple the", "# max_length.", "return", "sel...
165466b3ff6afd8024a4c8660421b0c4e7773db9