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
davidson
Return Davidson's Consonant Code. This is a wrapper for :py:meth:`Davidson.encode`. Parameters ---------- lname : str Last name (or word) to be encoded fname : str First name (optional), of which the first character is included in the code. omit_fname : bool Set...
abydos/phonetic/_davidson.py
def davidson(lname, fname='.', omit_fname=False): """Return Davidson's Consonant Code. This is a wrapper for :py:meth:`Davidson.encode`. Parameters ---------- lname : str Last name (or word) to be encoded fname : str First name (optional), of which the first character is includ...
def davidson(lname, fname='.', omit_fname=False): """Return Davidson's Consonant Code. This is a wrapper for :py:meth:`Davidson.encode`. Parameters ---------- lname : str Last name (or word) to be encoded fname : str First name (optional), of which the first character is includ...
[ "Return", "Davidson", "s", "Consonant", "Code", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_davidson.py#L100-L138
[ "def", "davidson", "(", "lname", ",", "fname", "=", "'.'", ",", "omit_fname", "=", "False", ")", ":", "return", "Davidson", "(", ")", ".", "encode", "(", "lname", ",", "fname", ",", "omit_fname", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Davidson.encode
Return Davidson's Consonant Code. Parameters ---------- lname : str Last name (or word) to be encoded fname : str First name (optional), of which the first character is included in the code. omit_fname : bool Set to True to complet...
abydos/phonetic/_davidson.py
def encode(self, lname, fname='.', omit_fname=False): """Return Davidson's Consonant Code. Parameters ---------- lname : str Last name (or word) to be encoded fname : str First name (optional), of which the first character is included in the c...
def encode(self, lname, fname='.', omit_fname=False): """Return Davidson's Consonant Code. Parameters ---------- lname : str Last name (or word) to be encoded fname : str First name (optional), of which the first character is included in the c...
[ "Return", "Davidson", "s", "Consonant", "Code", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_davidson.py#L50-L97
[ "def", "encode", "(", "self", ",", "lname", ",", "fname", "=", "'.'", ",", "omit_fname", "=", "False", ")", ":", "lname", "=", "text_type", "(", "lname", ".", "upper", "(", ")", ")", "code", "=", "self", ".", "_delete_consecutive_repeats", "(", "lname"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ac_encode
Encode a text using arithmetic coding with the provided probabilities. This is a wrapper for :py:meth:`Arithmetic.encode`. Parameters ---------- text : str A string to encode probs : dict A probability statistics dictionary generated by :py:meth:`Arithmetic.train` Retu...
abydos/compression/_arithmetic.py
def ac_encode(text, probs): """Encode a text using arithmetic coding with the provided probabilities. This is a wrapper for :py:meth:`Arithmetic.encode`. Parameters ---------- text : str A string to encode probs : dict A probability statistics dictionary generated by :p...
def ac_encode(text, probs): """Encode a text using arithmetic coding with the provided probabilities. This is a wrapper for :py:meth:`Arithmetic.encode`. Parameters ---------- text : str A string to encode probs : dict A probability statistics dictionary generated by :p...
[ "Encode", "a", "text", "using", "arithmetic", "coding", "with", "the", "provided", "probabilities", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_arithmetic.py#L300-L327
[ "def", "ac_encode", "(", "text", ",", "probs", ")", ":", "coder", "=", "Arithmetic", "(", ")", "coder", ".", "set_probs", "(", "probs", ")", "return", "coder", ".", "encode", "(", "text", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ac_decode
Decode the number to a string using the given statistics. This is a wrapper for :py:meth:`Arithmetic.decode`. Parameters ---------- longval : int The first part of an encoded tuple from ac_encode nbits : int The second part of an encoded tuple from ac_encode probs : dict ...
abydos/compression/_arithmetic.py
def ac_decode(longval, nbits, probs): """Decode the number to a string using the given statistics. This is a wrapper for :py:meth:`Arithmetic.decode`. Parameters ---------- longval : int The first part of an encoded tuple from ac_encode nbits : int The second part of an encoded...
def ac_decode(longval, nbits, probs): """Decode the number to a string using the given statistics. This is a wrapper for :py:meth:`Arithmetic.decode`. Parameters ---------- longval : int The first part of an encoded tuple from ac_encode nbits : int The second part of an encoded...
[ "Decode", "the", "number", "to", "a", "string", "using", "the", "given", "statistics", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_arithmetic.py#L330-L359
[ "def", "ac_decode", "(", "longval", ",", "nbits", ",", "probs", ")", ":", "coder", "=", "Arithmetic", "(", ")", "coder", ".", "set_probs", "(", "probs", ")", "return", "coder", ".", "decode", "(", "longval", ",", "nbits", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Arithmetic.train
r"""Generate a probability dict from the provided text. Text to 0-order probability statistics as a dict Parameters ---------- text : str The text data over which to calculate probability statistics. This must not contain the NUL (0x00) character because that is...
abydos/compression/_arithmetic.py
def train(self, text): r"""Generate a probability dict from the provided text. Text to 0-order probability statistics as a dict Parameters ---------- text : str The text data over which to calculate probability statistics. This must not contain the NUL (...
def train(self, text): r"""Generate a probability dict from the provided text. Text to 0-order probability statistics as a dict Parameters ---------- text : str The text data over which to calculate probability statistics. This must not contain the NUL (...
[ "r", "Generate", "a", "probability", "dict", "from", "the", "provided", "text", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_arithmetic.py#L86-L148
[ "def", "train", "(", "self", ",", "text", ")", ":", "text", "=", "text_type", "(", "text", ")", "if", "'\\x00'", "in", "text", ":", "text", "=", "text", ".", "replace", "(", "'\\x00'", ",", "' '", ")", "counts", "=", "Counter", "(", "text", ")", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Arithmetic.encode
Encode a text using arithmetic coding. Text and the 0-order probability statistics -> longval, nbits The encoded number is Fraction(longval, 2**nbits) Parameters ---------- text : str A string to encode Returns ------- tuple The...
abydos/compression/_arithmetic.py
def encode(self, text): """Encode a text using arithmetic coding. Text and the 0-order probability statistics -> longval, nbits The encoded number is Fraction(longval, 2**nbits) Parameters ---------- text : str A string to encode Returns --...
def encode(self, text): """Encode a text using arithmetic coding. Text and the 0-order probability statistics -> longval, nbits The encoded number is Fraction(longval, 2**nbits) Parameters ---------- text : str A string to encode Returns --...
[ "Encode", "a", "text", "using", "arithmetic", "coding", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_arithmetic.py#L150-L202
[ "def", "encode", "(", "self", ",", "text", ")", ":", "text", "=", "text_type", "(", "text", ")", "if", "'\\x00'", "in", "text", ":", "text", "=", "text", ".", "replace", "(", "'\\x00'", ",", "' '", ")", "minval", "=", "Fraction", "(", "0", ")", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Arithmetic.decode
Decode the number to a string using the given statistics. Parameters ---------- longval : int The first part of an encoded tuple from encode nbits : int The second part of an encoded tuple from encode Returns ------- str The a...
abydos/compression/_arithmetic.py
def decode(self, longval, nbits): """Decode the number to a string using the given statistics. Parameters ---------- longval : int The first part of an encoded tuple from encode nbits : int The second part of an encoded tuple from encode Returns ...
def decode(self, longval, nbits): """Decode the number to a string using the given statistics. Parameters ---------- longval : int The first part of an encoded tuple from encode nbits : int The second part of an encoded tuple from encode Returns ...
[ "Decode", "the", "number", "to", "a", "string", "using", "the", "given", "statistics", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_arithmetic.py#L204-L245
[ "def", "decode", "(", "self", ",", "longval", ",", "nbits", ")", ":", "val", "=", "Fraction", "(", "longval", ",", "long", "(", "1", ")", "<<", "nbits", ")", "letters", "=", "[", "]", "probs_items", "=", "[", "(", "char", ",", "minval", ",", "max...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
fuzzy_soundex
Return the Fuzzy Soundex code for a word. This is a wrapper for :py:meth:`FuzzySoundex.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 0...
abydos/phonetic/_fuzzy_soundex.py
def fuzzy_soundex(word, max_length=5, zero_pad=True): """Return the Fuzzy Soundex code for a word. This is a wrapper for :py:meth:`FuzzySoundex.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) z...
def fuzzy_soundex(word, max_length=5, zero_pad=True): """Return the Fuzzy Soundex code for a word. This is a wrapper for :py:meth:`FuzzySoundex.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 4) z...
[ "Return", "the", "Fuzzy", "Soundex", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_fuzzy_soundex.py#L162-L193
[ "def", "fuzzy_soundex", "(", "word", ",", "max_length", "=", "5", ",", "zero_pad", "=", "True", ")", ":", "return", "FuzzySoundex", "(", ")", ".", "encode", "(", "word", ",", "max_length", ",", "zero_pad", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
FuzzySoundex.encode
Return the Fuzzy Soundex 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/_fuzzy_soundex.py
def encode(self, word, max_length=5, zero_pad=True): """Return the Fuzzy Soundex 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 P...
def encode(self, word, max_length=5, zero_pad=True): """Return the Fuzzy Soundex 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 P...
[ "Return", "the", "Fuzzy", "Soundex", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_fuzzy_soundex.py#L54-L159
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "5", ",", "zero_pad", "=", "True", ")", ":", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upper", "(", ")", ")", ")", "word", "=", "word", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NGramCorpus.corpus_importer
r"""Fill in self.ngcorpus from a Corpus argument. Parameters ---------- corpus :Corpus The Corpus from which to initialize the n-gram corpus n_val : int Maximum n value for n-grams bos : str String to insert as an indicator of beginning of sen...
abydos/corpus/_ngram_corpus.py
def corpus_importer(self, corpus, n_val=1, bos='_START_', eos='_END_'): r"""Fill in self.ngcorpus from a Corpus argument. Parameters ---------- corpus :Corpus The Corpus from which to initialize the n-gram corpus n_val : int Maximum n value for n-grams ...
def corpus_importer(self, corpus, n_val=1, bos='_START_', eos='_END_'): r"""Fill in self.ngcorpus from a Corpus argument. Parameters ---------- corpus :Corpus The Corpus from which to initialize the n-gram corpus n_val : int Maximum n value for n-grams ...
[ "r", "Fill", "in", "self", ".", "ngcorpus", "from", "a", "Corpus", "argument", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_ngram_corpus.py#L93-L139
[ "def", "corpus_importer", "(", "self", ",", "corpus", ",", "n_val", "=", "1", ",", "bos", "=", "'_START_'", ",", "eos", "=", "'_END_'", ")", ":", "if", "not", "corpus", "or", "not", "isinstance", "(", "corpus", ",", "Corpus", ")", ":", "raise", "Type...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NGramCorpus.get_count
r"""Get the count of an n-gram in the corpus. Parameters ---------- ngram : str The n-gram to retrieve the count of from the n-gram corpus corpus : Corpus The corpus Returns ------- int The n-gram count Examples ...
abydos/corpus/_ngram_corpus.py
def get_count(self, ngram, corpus=None): r"""Get the count of an n-gram in the corpus. Parameters ---------- ngram : str The n-gram to retrieve the count of from the n-gram corpus corpus : Corpus The corpus Returns ------- int ...
def get_count(self, ngram, corpus=None): r"""Get the count of an n-gram in the corpus. Parameters ---------- ngram : str The n-gram to retrieve the count of from the n-gram corpus corpus : Corpus The corpus Returns ------- int ...
[ "r", "Get", "the", "count", "of", "an", "n", "-", "gram", "in", "the", "corpus", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_ngram_corpus.py#L141-L183
[ "def", "get_count", "(", "self", ",", "ngram", ",", "corpus", "=", "None", ")", ":", "if", "not", "corpus", ":", "corpus", "=", "self", ".", "ngcorpus", "# if ngram is empty, we're at our leaf node and should return the", "# value in None", "if", "not", "ngram", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NGramCorpus._add_to_ngcorpus
Build up a corpus entry recursively. Parameters ---------- corpus : Corpus The corpus words : [str] Words to add to the corpus count : int Count of words
abydos/corpus/_ngram_corpus.py
def _add_to_ngcorpus(self, corpus, words, count): """Build up a corpus entry recursively. Parameters ---------- corpus : Corpus The corpus words : [str] Words to add to the corpus count : int Count of words """ if word...
def _add_to_ngcorpus(self, corpus, words, count): """Build up a corpus entry recursively. Parameters ---------- corpus : Corpus The corpus words : [str] Words to add to the corpus count : int Count of words """ if word...
[ "Build", "up", "a", "corpus", "entry", "recursively", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_ngram_corpus.py#L185-L204
[ "def", "_add_to_ngcorpus", "(", "self", ",", "corpus", ",", "words", ",", "count", ")", ":", "if", "words", "[", "0", "]", "not", "in", "corpus", ":", "corpus", "[", "words", "[", "0", "]", "]", "=", "Counter", "(", ")", "if", "len", "(", "words"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NGramCorpus.gng_importer
Fill in self.ngcorpus from a Google NGram corpus file. Parameters ---------- corpus_file : file The Google NGram file from which to initialize the n-gram corpus
abydos/corpus/_ngram_corpus.py
def gng_importer(self, corpus_file): """Fill in self.ngcorpus from a Google NGram corpus file. Parameters ---------- corpus_file : file The Google NGram file from which to initialize the n-gram corpus """ with c_open(corpus_file, 'r', encoding='utf-8') as gn...
def gng_importer(self, corpus_file): """Fill in self.ngcorpus from a Google NGram corpus file. Parameters ---------- corpus_file : file The Google NGram file from which to initialize the n-gram corpus """ with c_open(corpus_file, 'r', encoding='utf-8') as gn...
[ "Fill", "in", "self", ".", "ngcorpus", "from", "a", "Google", "NGram", "corpus", "file", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_ngram_corpus.py#L206-L220
[ "def", "gng_importer", "(", "self", ",", "corpus_file", ")", ":", "with", "c_open", "(", "corpus_file", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "gng", ":", "for", "line", "in", "gng", ":", "line", "=", "line", ".", "rstrip", "(", ")",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NGramCorpus.tf
r"""Return term frequency. Parameters ---------- term : str The term for which to calculate tf Returns ------- float The term frequency (tf) Raises ------ ValueError tf can only calculate the frequency of indi...
abydos/corpus/_ngram_corpus.py
def tf(self, term): r"""Return term frequency. Parameters ---------- term : str The term for which to calculate tf Returns ------- float The term frequency (tf) Raises ------ ValueError tf can only cal...
def tf(self, term): r"""Return term frequency. Parameters ---------- term : str The term for which to calculate tf Returns ------- float The term frequency (tf) Raises ------ ValueError tf can only cal...
[ "r", "Return", "term", "frequency", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_ngram_corpus.py#L222-L258
[ "def", "tf", "(", "self", ",", "term", ")", ":", "if", "' '", "in", "term", ":", "raise", "ValueError", "(", "'tf can only calculate the term frequency of individual words'", ")", "tcount", "=", "self", ".", "get_count", "(", "term", ")", "if", "tcount", "==",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SPFC.encode
Return the Standardized Phonetic Frequency Code (SPFC) of a word. Parameters ---------- word : str The word to transform Returns ------- str The SPFC value Raises ------ AttributeError Word attribute must be a...
abydos/phonetic/_spfc.py
def encode(self, word): """Return the Standardized Phonetic Frequency Code (SPFC) of a word. Parameters ---------- word : str The word to transform Returns ------- str The SPFC value Raises ------ AttributeError ...
def encode(self, word): """Return the Standardized Phonetic Frequency Code (SPFC) of a word. Parameters ---------- word : str The word to transform Returns ------- str The SPFC value Raises ------ AttributeError ...
[ "Return", "the", "Standardized", "Phonetic", "Frequency", "Code", "(", "SPFC", ")", "of", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_spfc.py#L75-L249
[ "def", "encode", "(", "self", ",", "word", ")", ":", "def", "_raise_word_ex", "(", ")", ":", "\"\"\"Raise an AttributeError.\n\n Raises\n ------\n AttributeError\n Word attribute must be a string with a space or period dividing\n ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BWT.encode
r"""Return the Burrows-Wheeler transformed form of a word. Parameters ---------- word : str The word to transform using BWT terminator : str A character added to signal the end of the string Returns ------- str Word encoded by...
abydos/compression/_bwt.py
def encode(self, word, terminator='\0'): r"""Return the Burrows-Wheeler transformed form of a word. Parameters ---------- word : str The word to transform using BWT terminator : str A character added to signal the end of the string Returns ...
def encode(self, word, terminator='\0'): r"""Return the Burrows-Wheeler transformed form of a word. Parameters ---------- word : str The word to transform using BWT terminator : str A character added to signal the end of the string Returns ...
[ "r", "Return", "the", "Burrows", "-", "Wheeler", "transformed", "form", "of", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_bwt.py#L45-L90
[ "def", "encode", "(", "self", ",", "word", ",", "terminator", "=", "'\\0'", ")", ":", "if", "word", ":", "if", "terminator", "in", "word", ":", "raise", "ValueError", "(", "'Specified terminator, {}, already in word.'", ".", "format", "(", "terminator", "if", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BWT.decode
r"""Return a word decoded from BWT form. Parameters ---------- code : str The word to transform from BWT form terminator : str A character added to signal the end of the string Returns ------- str Word decoded by BWT ...
abydos/compression/_bwt.py
def decode(self, code, terminator='\0'): r"""Return a word decoded from BWT form. Parameters ---------- code : str The word to transform from BWT form terminator : str A character added to signal the end of the string Returns ------- ...
def decode(self, code, terminator='\0'): r"""Return a word decoded from BWT form. Parameters ---------- code : str The word to transform from BWT form terminator : str A character added to signal the end of the string Returns ------- ...
[ "r", "Return", "a", "word", "decoded", "from", "BWT", "form", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/compression/_bwt.py#L92-L139
[ "def", "decode", "(", "self", ",", "code", ",", "terminator", "=", "'\\0'", ")", ":", "if", "code", ":", "if", "terminator", "not", "in", "code", ":", "raise", "ValueError", "(", "'Specified terminator, {}, absent from code.'", ".", "format", "(", "terminator"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Indel.dist_abs
Return the indel distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison Returns ------- int Indel distance Examples -------- >...
abydos/distance/_indel.py
def dist_abs(self, src, tar): """Return the indel distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison Returns ------- int Indel distance ...
def dist_abs(self, src, tar): """Return the indel distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison Returns ------- int Indel distance ...
[ "Return", "the", "indel", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_indel.py#L46-L76
[ "def", "dist_abs", "(", "self", ",", "src", ",", "tar", ")", ":", "return", "self", ".", "_lev", ".", "dist_abs", "(", "src", ",", "tar", ",", "mode", "=", "'lev'", ",", "cost", "=", "(", "1", ",", "1", ",", "9999", ",", "9999", ")", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Indel.dist
Return the normalized indel distance between two strings. This is equivalent to normalized Levenshtein distance, when only inserts and deletes are possible. Parameters ---------- src : str Source string for comparison tar : str Target string for ...
abydos/distance/_indel.py
def dist(self, src, tar): """Return the normalized indel distance between two strings. This is equivalent to normalized Levenshtein distance, when only inserts and deletes are possible. Parameters ---------- src : str Source string for comparison tar...
def dist(self, src, tar): """Return the normalized indel distance between two strings. This is equivalent to normalized Levenshtein distance, when only inserts and deletes are possible. Parameters ---------- src : str Source string for comparison tar...
[ "Return", "the", "normalized", "indel", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_indel.py#L78-L111
[ "def", "dist", "(", "self", ",", "src", ",", "tar", ")", ":", "if", "src", "==", "tar", ":", "return", "0.0", "return", "self", ".", "dist_abs", "(", "src", ",", "tar", ")", "/", "(", "len", "(", "src", ")", "+", "len", "(", "tar", ")", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Haase.encode
Return the Haase Phonetik (numeric output) code for a word. While the output code is numeric, it is nevertheless a str. Parameters ---------- word : str The word to transform primary_only : bool If True, only the primary code is returned Returns...
abydos/phonetic/_haase.py
def encode(self, word, primary_only=False): """Return the Haase Phonetik (numeric output) code for a word. While the output code is numeric, it is nevertheless a str. Parameters ---------- word : str The word to transform primary_only : bool If T...
def encode(self, word, primary_only=False): """Return the Haase Phonetik (numeric output) code for a word. While the output code is numeric, it is nevertheless a str. Parameters ---------- word : str The word to transform primary_only : bool If T...
[ "Return", "the", "Haase", "Phonetik", "(", "numeric", "output", ")", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_haase.py#L52-L245
[ "def", "encode", "(", "self", ",", "word", ",", "primary_only", "=", "False", ")", ":", "def", "_after", "(", "word", ",", "pos", ",", "letters", ")", ":", "\"\"\"Return True if word[pos] follows one of the supplied letters.\n\n Parameters\n --------...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
_Distance.sim
Return similarity. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison *args Variable length argument list. **kwargs Arbitrary keyword arguments. Returns ----...
abydos/distance/_distance.py
def sim(self, src, tar, *args, **kwargs): """Return similarity. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison *args Variable length argument list. **kwargs Arbit...
def sim(self, src, tar, *args, **kwargs): """Return similarity. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison *args Variable length argument list. **kwargs Arbit...
[ "Return", "similarity", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_distance.py#L35-L55
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "1.0", "-", "self", ".", "dist", "(", "src", ",", "tar", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
_Distance.dist_abs
Return absolute distance. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison *args Variable length argument list. **kwargs Arbitrary keyword arguments. Returns ...
abydos/distance/_distance.py
def dist_abs(self, src, tar, *args, **kwargs): """Return absolute distance. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison *args Variable length argument list. **kwargs ...
def dist_abs(self, src, tar, *args, **kwargs): """Return absolute distance. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison *args Variable length argument list. **kwargs ...
[ "Return", "absolute", "distance", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_distance.py#L79-L99
[ "def", "dist_abs", "(", "self", ",", "src", ",", "tar", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "dist", "(", "src", ",", "tar", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
occurrence_fingerprint
Return the occurrence fingerprint. This is a wrapper for :py:meth:`Occurrence.fingerprint`. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned most_common : list The most common tokens in the target language,...
abydos/fingerprint/_occurrence.py
def occurrence_fingerprint( word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG ): """Return the occurrence fingerprint. This is a wrapper for :py:meth:`Occurrence.fingerprint`. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fing...
def occurrence_fingerprint( word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG ): """Return the occurrence fingerprint. This is a wrapper for :py:meth:`Occurrence.fingerprint`. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fing...
[ "Return", "the", "occurrence", "fingerprint", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_occurrence.py#L93-L128
[ "def", "occurrence_fingerprint", "(", "word", ",", "n_bits", "=", "16", ",", "most_common", "=", "MOST_COMMON_LETTERS_CG", ")", ":", "return", "Occurrence", "(", ")", ".", "fingerprint", "(", "word", ",", "n_bits", ",", "most_common", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Occurrence.fingerprint
Return the occurrence fingerprint. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned most_common : list The most common tokens in the target language, ordered by frequency ...
abydos/fingerprint/_occurrence.py
def fingerprint(self, word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG): """Return the occurrence fingerprint. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned most_common : list ...
def fingerprint(self, word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG): """Return the occurrence fingerprint. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned most_common : list ...
[ "Return", "the", "occurrence", "fingerprint", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_occurrence.py#L42-L90
[ "def", "fingerprint", "(", "self", ",", "word", ",", "n_bits", "=", "16", ",", "most_common", "=", "MOST_COMMON_LETTERS_CG", ")", ":", "word", "=", "set", "(", "word", ")", "fingerprint", "=", "0", "for", "letter", "in", "most_common", ":", "if", "letter...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_baystat
Return the Baystat similarity. This is a wrapper for :py:meth:`Baystat.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison min_ss_len : int Minimum substring length to be considered left_ext :int Left-sid...
abydos/distance/_baystat.py
def sim_baystat(src, tar, min_ss_len=None, left_ext=None, right_ext=None): """Return the Baystat similarity. This is a wrapper for :py:meth:`Baystat.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison min_ss_len : int ...
def sim_baystat(src, tar, min_ss_len=None, left_ext=None, right_ext=None): """Return the Baystat similarity. This is a wrapper for :py:meth:`Baystat.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison min_ss_len : int ...
[ "Return", "the", "Baystat", "similarity", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_baystat.py#L176-L211
[ "def", "sim_baystat", "(", "src", ",", "tar", ",", "min_ss_len", "=", "None", ",", "left_ext", "=", "None", ",", "right_ext", "=", "None", ")", ":", "return", "Baystat", "(", ")", ".", "sim", "(", "src", ",", "tar", ",", "min_ss_len", ",", "left_ext"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_baystat
Return the Baystat distance. This is a wrapper for :py:meth:`Baystat.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison min_ss_len : int Minimum substring length to be considered left_ext : int Left-sid...
abydos/distance/_baystat.py
def dist_baystat(src, tar, min_ss_len=None, left_ext=None, right_ext=None): """Return the Baystat distance. This is a wrapper for :py:meth:`Baystat.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison min_ss_len : int ...
def dist_baystat(src, tar, min_ss_len=None, left_ext=None, right_ext=None): """Return the Baystat distance. This is a wrapper for :py:meth:`Baystat.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison min_ss_len : int ...
[ "Return", "the", "Baystat", "distance", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_baystat.py#L214-L249
[ "def", "dist_baystat", "(", "src", ",", "tar", ",", "min_ss_len", "=", "None", ",", "left_ext", "=", "None", ",", "right_ext", "=", "None", ")", ":", "return", "Baystat", "(", ")", ".", "dist", "(", "src", ",", "tar", ",", "min_ss_len", ",", "left_ex...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Baystat.sim
Return the Baystat similarity. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison min_ss_len : int Minimum substring length to be considered left_ext :int Left-side extension...
abydos/distance/_baystat.py
def sim(self, src, tar, min_ss_len=None, left_ext=None, right_ext=None): """Return the Baystat similarity. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison min_ss_len : int Minimum sub...
def sim(self, src, tar, min_ss_len=None, left_ext=None, right_ext=None): """Return the Baystat similarity. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison min_ss_len : int Minimum sub...
[ "Return", "the", "Baystat", "similarity", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_baystat.py#L49-L173
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ",", "min_ss_len", "=", "None", ",", "left_ext", "=", "None", ",", "right_ext", "=", "None", ")", ":", "if", "src", "==", "tar", ":", "return", "1.0", "if", "not", "src", "or", "not", "tar", ":",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_tversky
Return the Tversky index of two strings. This is a wrapper for :py:meth:`Tversky.sim`. 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 ea...
abydos/distance/_tversky.py
def sim_tversky(src, tar, qval=2, alpha=1, beta=1, bias=None): """Return the Tversky index of two strings. This is a wrapper for :py:meth:`Tversky.sim`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/C...
def sim_tversky(src, tar, qval=2, alpha=1, beta=1, bias=None): """Return the Tversky index of two strings. This is a wrapper for :py:meth:`Tversky.sim`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/C...
[ "Return", "the", "Tversky", "index", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_tversky.py#L146-L183
[ "def", "sim_tversky", "(", "src", ",", "tar", ",", "qval", "=", "2", ",", "alpha", "=", "1", ",", "beta", "=", "1", ",", "bias", "=", "None", ")", ":", "return", "Tversky", "(", ")", ".", "sim", "(", "src", ",", "tar", ",", "qval", ",", "alph...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_tversky
Return the Tversky distance between two strings. This is a wrapper for :py:meth:`Tversky.dist`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/Counter objects) for comparison qval : int The len...
abydos/distance/_tversky.py
def dist_tversky(src, tar, qval=2, alpha=1, beta=1, bias=None): """Return the Tversky distance between two strings. This is a wrapper for :py:meth:`Tversky.dist`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (o...
def dist_tversky(src, tar, qval=2, alpha=1, beta=1, bias=None): """Return the Tversky distance between two strings. This is a wrapper for :py:meth:`Tversky.dist`. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (o...
[ "Return", "the", "Tversky", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_tversky.py#L186-L223
[ "def", "dist_tversky", "(", "src", ",", "tar", ",", "qval", "=", "2", ",", "alpha", "=", "1", ",", "beta", "=", "1", ",", "bias", "=", "None", ")", ":", "return", "Tversky", "(", ")", ".", "dist", "(", "src", ",", "tar", ",", "qval", ",", "al...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Tversky.sim
Return the Tversky index 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; 0 for no...
abydos/distance/_tversky.py
def sim(self, src, tar, qval=2, alpha=1, beta=1, bias=None): """Return the Tversky index of two strings. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/Counter objects) for compa...
def sim(self, src, tar, qval=2, alpha=1, beta=1, bias=None): """Return the Tversky index of two strings. Parameters ---------- src : str Source string (or QGrams/Counter objects) for comparison tar : str Target string (or QGrams/Counter objects) for compa...
[ "Return", "the", "Tversky", "index", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_tversky.py#L68-L143
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ",", "qval", "=", "2", ",", "alpha", "=", "1", ",", "beta", "=", "1", ",", "bias", "=", "None", ")", ":", "if", "alpha", "<", "0", "or", "beta", "<", "0", ":", "raise", "ValueError", "(", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
LCSseq.lcsseq
Return the longest common subsequence of two strings. Based on the dynamic programming algorithm from http://rosettacode.org/wiki/Longest_common_subsequence :cite:`rosettacode:2018b`. This is licensed GFDL 1.2. Modifications include: conversion to a numpy array in place of ...
abydos/distance/_lcsseq.py
def lcsseq(self, src, tar): """Return the longest common subsequence of two strings. Based on the dynamic programming algorithm from http://rosettacode.org/wiki/Longest_common_subsequence :cite:`rosettacode:2018b`. This is licensed GFDL 1.2. Modifications include: c...
def lcsseq(self, src, tar): """Return the longest common subsequence of two strings. Based on the dynamic programming algorithm from http://rosettacode.org/wiki/Longest_common_subsequence :cite:`rosettacode:2018b`. This is licensed GFDL 1.2. Modifications include: c...
[ "Return", "the", "longest", "common", "subsequence", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_lcsseq.py#L46-L105
[ "def", "lcsseq", "(", "self", ",", "src", ",", "tar", ")", ":", "lengths", "=", "np_zeros", "(", "(", "len", "(", "src", ")", "+", "1", ",", "len", "(", "tar", ")", "+", "1", ")", ",", "dtype", "=", "np_int", ")", "# row 0 and column 0 are initiali...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
LCSseq.sim
r"""Return the longest common subsequence similarity of two strings. Longest common subsequence similarity (:math:`sim_{LCSseq}`). This employs the LCSseq function to derive a similarity metric: :math:`sim_{LCSseq}(s,t) = \frac{|LCSseq(s,t)|}{max(|s|, |t|)}` Parameters -------...
abydos/distance/_lcsseq.py
def sim(self, src, tar): r"""Return the longest common subsequence similarity of two strings. Longest common subsequence similarity (:math:`sim_{LCSseq}`). This employs the LCSseq function to derive a similarity metric: :math:`sim_{LCSseq}(s,t) = \frac{|LCSseq(s,t)|}{max(|s|, |t|)}` ...
def sim(self, src, tar): r"""Return the longest common subsequence similarity of two strings. Longest common subsequence similarity (:math:`sim_{LCSseq}`). This employs the LCSseq function to derive a similarity metric: :math:`sim_{LCSseq}(s,t) = \frac{|LCSseq(s,t)|}{max(|s|, |t|)}` ...
[ "r", "Return", "the", "longest", "common", "subsequence", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_lcsseq.py#L107-L144
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ")", ":", "if", "src", "==", "tar", ":", "return", "1.0", "elif", "not", "src", "or", "not", "tar", ":", "return", "0.0", "return", "len", "(", "self", ".", "lcsseq", "(", "src", ",", "tar", ")...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Prefix.sim
Return the prefix similarity of two strings. Prefix similarity is the ratio of the length of the shorter term that exactly matches the longer term to the length of the shorter term, beginning at the start of both terms. Parameters ---------- src : str Source...
abydos/distance/_prefix.py
def sim(self, src, tar): """Return the prefix similarity of two strings. Prefix similarity is the ratio of the length of the shorter term that exactly matches the longer term to the length of the shorter term, beginning at the start of both terms. Parameters ---------- ...
def sim(self, src, tar): """Return the prefix similarity of two strings. Prefix similarity is the ratio of the length of the shorter term that exactly matches the longer term to the length of the shorter term, beginning at the start of both terms. Parameters ---------- ...
[ "Return", "the", "prefix", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_prefix.py#L41-L82
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ")", ":", "if", "src", "==", "tar", ":", "return", "1.0", "if", "not", "src", "or", "not", "tar", ":", "return", "0.0", "min_word", ",", "max_word", "=", "(", "src", ",", "tar", ")", "if", "len...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
count_fingerprint
Return the count fingerprint. This is a wrapper for :py:meth:`Count.fingerprint`. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned most_common : list The most common tokens in the target language, ordered b...
abydos/fingerprint/_count.py
def count_fingerprint(word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG): """Return the count fingerprint. This is a wrapper for :py:meth:`Count.fingerprint`. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned ...
def count_fingerprint(word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG): """Return the count fingerprint. This is a wrapper for :py:meth:`Count.fingerprint`. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned ...
[ "Return", "the", "count", "fingerprint", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_count.py#L96-L129
[ "def", "count_fingerprint", "(", "word", ",", "n_bits", "=", "16", ",", "most_common", "=", "MOST_COMMON_LETTERS_CG", ")", ":", "return", "Count", "(", ")", ".", "fingerprint", "(", "word", ",", "n_bits", ",", "most_common", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Count.fingerprint
Return the count fingerprint. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned most_common : list The most common tokens in the target language, ordered by frequency Retu...
abydos/fingerprint/_count.py
def fingerprint(self, word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG): """Return the count fingerprint. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned most_common : list ...
def fingerprint(self, word, n_bits=16, most_common=MOST_COMMON_LETTERS_CG): """Return the count fingerprint. Parameters ---------- word : str The word to fingerprint n_bits : int Number of bits in the fingerprint returned most_common : list ...
[ "Return", "the", "count", "fingerprint", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_count.py#L44-L93
[ "def", "fingerprint", "(", "self", ",", "word", ",", "n_bits", "=", "16", ",", "most_common", "=", "MOST_COMMON_LETTERS_CG", ")", ":", "if", "n_bits", "%", "2", ":", "n_bits", "+=", "1", "word", "=", "Counter", "(", "word", ")", "fingerprint", "=", "0"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
phonetic_fingerprint
Return the phonetic fingerprint of a phrase. This is a wrapper for :py:meth:`Phonetic.fingerprint`. Parameters ---------- phrase : str The string from which to calculate the phonetic fingerprint phonetic_algorithm : function A phonetic algorithm that takes a string and returns a st...
abydos/fingerprint/_phonetic.py
def phonetic_fingerprint( phrase, phonetic_algorithm=double_metaphone, joiner=' ', *args, **kwargs ): """Return the phonetic fingerprint of a phrase. This is a wrapper for :py:meth:`Phonetic.fingerprint`. Parameters ---------- phrase : str The string from which to calculate the phoneti...
def phonetic_fingerprint( phrase, phonetic_algorithm=double_metaphone, joiner=' ', *args, **kwargs ): """Return the phonetic fingerprint of a phrase. This is a wrapper for :py:meth:`Phonetic.fingerprint`. Parameters ---------- phrase : str The string from which to calculate the phoneti...
[ "Return", "the", "phonetic", "fingerprint", "of", "a", "phrase", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_phonetic.py#L100-L139
[ "def", "phonetic_fingerprint", "(", "phrase", ",", "phonetic_algorithm", "=", "double_metaphone", ",", "joiner", "=", "' '", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "Phonetic", "(", ")", ".", "fingerprint", "(", "phrase", ",", "phone...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Phonetic.fingerprint
Return the phonetic fingerprint of a phrase. Parameters ---------- phrase : str The string from which to calculate the phonetic fingerprint phonetic_algorithm : function A phonetic algorithm that takes a string and returns a string (presumably a phone...
abydos/fingerprint/_phonetic.py
def fingerprint( self, phrase, phonetic_algorithm=double_metaphone, joiner=' ', *args, **kwargs ): """Return the phonetic fingerprint of a phrase. Parameters ---------- phrase : str The string from which to calculate the ph...
def fingerprint( self, phrase, phonetic_algorithm=double_metaphone, joiner=' ', *args, **kwargs ): """Return the phonetic fingerprint of a phrase. Parameters ---------- phrase : str The string from which to calculate the ph...
[ "Return", "the", "phonetic", "fingerprint", "of", "a", "phrase", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_phonetic.py#L49-L97
[ "def", "fingerprint", "(", "self", ",", "phrase", ",", "phonetic_algorithm", "=", "double_metaphone", ",", "joiner", "=", "' '", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "phonetic", "=", "''", "for", "word", "in", "phrase", ".", "split", "(...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Corpus.docs_of_words
r"""Return the docs in the corpus, with sentences flattened. Each list within the corpus represents all the words of that document. Thus the sentence level of lists has been flattened. Returns ------- [[str]] The docs in the corpus as a list of list of strs ...
abydos/corpus/_corpus.py
def docs_of_words(self): r"""Return the docs in the corpus, with sentences flattened. Each list within the corpus represents all the words of that document. Thus the sentence level of lists has been flattened. Returns ------- [[str]] The docs in the corpus a...
def docs_of_words(self): r"""Return the docs in the corpus, with sentences flattened. Each list within the corpus represents all the words of that document. Thus the sentence level of lists has been flattened. Returns ------- [[str]] The docs in the corpus a...
[ "r", "Return", "the", "docs", "in", "the", "corpus", "with", "sentences", "flattened", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_corpus.py#L203-L229
[ "def", "docs_of_words", "(", "self", ")", ":", "return", "[", "[", "words", "for", "sents", "in", "doc", "for", "words", "in", "sents", "]", "for", "doc", "in", "self", ".", "corpus", "]" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Corpus.raw
r"""Return the raw corpus. This is reconstructed by joining sub-components with the corpus' split characters Returns ------- str The raw corpus Example ------- >>> tqbf = 'The quick brown fox jumped over the lazy dog.\n' >>> tqbf += ...
abydos/corpus/_corpus.py
def raw(self): r"""Return the raw corpus. This is reconstructed by joining sub-components with the corpus' split characters Returns ------- str The raw corpus Example ------- >>> tqbf = 'The quick brown fox jumped over the lazy dog.\...
def raw(self): r"""Return the raw corpus. This is reconstructed by joining sub-components with the corpus' split characters Returns ------- str The raw corpus Example ------- >>> tqbf = 'The quick brown fox jumped over the lazy dog.\...
[ "r", "Return", "the", "raw", "corpus", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_corpus.py#L231-L262
[ "def", "raw", "(", "self", ")", ":", "doc_list", "=", "[", "]", "for", "doc", "in", "self", ".", "corpus", ":", "sent_list", "=", "[", "]", "for", "sent", "in", "doc", ":", "sent_list", ".", "append", "(", "' '", ".", "join", "(", "sent", ")", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Corpus.idf
r"""Calculate the Inverse Document Frequency of a term in the corpus. Parameters ---------- term : str The term to calculate the IDF of transform : function A function to apply to each document term before checking for the presence of term Re...
abydos/corpus/_corpus.py
def idf(self, term, transform=None): r"""Calculate the Inverse Document Frequency of a term in the corpus. Parameters ---------- term : str The term to calculate the IDF of transform : function A function to apply to each document term before checking for...
def idf(self, term, transform=None): r"""Calculate the Inverse Document Frequency of a term in the corpus. Parameters ---------- term : str The term to calculate the IDF of transform : function A function to apply to each document term before checking for...
[ "r", "Calculate", "the", "Inverse", "Document", "Frequency", "of", "a", "term", "in", "the", "corpus", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/corpus/_corpus.py#L264-L312
[ "def", "idf", "(", "self", ",", "term", ",", "transform", "=", "None", ")", ":", "docs_with_term", "=", "0", "docs", "=", "self", ".", "docs_of_words", "(", ")", "for", "doc", "in", "docs", ":", "doc_set", "=", "set", "(", "doc", ")", "if", "transf...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
PaiceHusk.stem
Return Paice-Husk stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = PaiceHusk() >>> stmr.stem('assumption') 'assum' >>> stmr.stem('v...
abydos/stemmer/_paice_husk.py
def stem(self, word): """Return Paice-Husk stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = PaiceHusk() >>> stmr.stem('assumption') ...
def stem(self, word): """Return Paice-Husk stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = PaiceHusk() >>> stmr.stem('assumption') ...
[ "Return", "Paice", "-", "Husk", "stem", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_paice_husk.py#L201-L256
[ "def", "stem", "(", "self", ",", "word", ")", ":", "terminate", "=", "False", "intact", "=", "True", "while", "not", "terminate", ":", "for", "n", "in", "range", "(", "6", ",", "0", ",", "-", "1", ")", ":", "if", "word", "[", "-", "n", ":", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
RethSchek.encode
Return Reth-Schek Phonetik code for a word. Parameters ---------- word : str The word to transform Returns ------- str The Reth-Schek Phonetik code Examples -------- >>> reth_schek_phonetik('Joachim') 'JOAGHIM' ...
abydos/phonetic/_reth_schek.py
def encode(self, word): """Return Reth-Schek Phonetik code for a word. Parameters ---------- word : str The word to transform Returns ------- str The Reth-Schek Phonetik code Examples -------- >>> reth_schek_phone...
def encode(self, word): """Return Reth-Schek Phonetik code for a word. Parameters ---------- word : str The word to transform Returns ------- str The Reth-Schek Phonetik code Examples -------- >>> reth_schek_phone...
[ "Return", "Reth", "-", "Schek", "Phonetik", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_reth_schek.py#L127-L189
[ "def", "encode", "(", "self", ",", "word", ")", ":", "# Uppercase", "word", "=", "word", ".", "upper", "(", ")", "# Replace umlauts/eszett", "word", "=", "word", ".", "replace", "(", "'Ä',", " ", "AE')", "", "word", "=", "word", ".", "replace", "(", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SfinxBis.encode
Return the SfinxBis code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to unlimited) Returns ------- tuple The SfinxBis value Examples ...
abydos/phonetic/_sfinx_bis.py
def encode(self, word, max_length=-1): """Return the SfinxBis code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to unlimited) Returns ------- tuple ...
def encode(self, word, max_length=-1): """Return the SfinxBis code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to unlimited) Returns ------- tuple ...
[ "Return", "the", "SfinxBis", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_sfinx_bis.py#L154-L357
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "-", "1", ")", ":", "def", "_foersvensker", "(", "lokal_ordet", ")", ":", "\"\"\"Return the Swedish-ized form of the word.\n\n Parameters\n ----------\n lokal_ordet : str\n ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
bmpm
Return the Beider-Morse Phonetic Matching encoding(s) of a term. This is a wrapper for :py:meth:`BeiderMorse.encode`. Parameters ---------- word : str The word to transform language_arg : str The language of the term; supported values include: - ``any`` - `...
abydos/phonetic/_beider_morse.py
def bmpm( word, language_arg=0, name_mode='gen', match_mode='approx', concat=False, filter_langs=False, ): """Return the Beider-Morse Phonetic Matching encoding(s) of a term. This is a wrapper for :py:meth:`BeiderMorse.encode`. Parameters ---------- word : str The w...
def bmpm( word, language_arg=0, name_mode='gen', match_mode='approx', concat=False, filter_langs=False, ): """Return the Beider-Morse Phonetic Matching encoding(s) of a term. This is a wrapper for :py:meth:`BeiderMorse.encode`. Parameters ---------- word : str The w...
[ "Return", "the", "Beider", "-", "Morse", "Phonetic", "Matching", "encoding", "(", "s", ")", "of", "a", "term", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L936-L1025
[ "def", "bmpm", "(", "word", ",", "language_arg", "=", "0", ",", "name_mode", "=", "'gen'", ",", "match_mode", "=", "'approx'", ",", "concat", "=", "False", ",", "filter_langs", "=", "False", ",", ")", ":", "return", "BeiderMorse", "(", ")", ".", "encod...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._language
Return the best guess language ID for the word and language choices. Parameters ---------- name : str The term to guess the language of name_mode : str The name mode of the algorithm: ``gen`` (default), ``ash`` (Ashkenazi), or ``sep`` (Sephardic) ...
abydos/phonetic/_beider_morse.py
def _language(self, name, name_mode): """Return the best guess language ID for the word and language choices. Parameters ---------- name : str The term to guess the language of name_mode : str The name mode of the algorithm: ``gen`` (default), ...
def _language(self, name, name_mode): """Return the best guess language ID for the word and language choices. Parameters ---------- name : str The term to guess the language of name_mode : str The name mode of the algorithm: ``gen`` (default), ...
[ "Return", "the", "best", "guess", "language", "ID", "for", "the", "word", "and", "language", "choices", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L147-L179
[ "def", "_language", "(", "self", ",", "name", ",", "name_mode", ")", ":", "name", "=", "name", ".", "strip", "(", ")", ".", "lower", "(", ")", "rules", "=", "BMDATA", "[", "name_mode", "]", "[", "'language_rules'", "]", "all_langs", "=", "(", "sum", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._redo_language
Reassess the language of the terms and call the phonetic encoder. Uses a split multi-word term. Parameters ---------- term : str The term to encode via Beider-Morse name_mode : str The name mode of the algorithm: ``gen`` (default), ``ash`` (A...
abydos/phonetic/_beider_morse.py
def _redo_language( self, term, name_mode, rules, final_rules1, final_rules2, concat ): """Reassess the language of the terms and call the phonetic encoder. Uses a split multi-word term. Parameters ---------- term : str The term to encode via Beider-Mors...
def _redo_language( self, term, name_mode, rules, final_rules1, final_rules2, concat ): """Reassess the language of the terms and call the phonetic encoder. Uses a split multi-word term. Parameters ---------- term : str The term to encode via Beider-Mors...
[ "Reassess", "the", "language", "of", "the", "terms", "and", "call", "the", "phonetic", "encoder", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L181-L219
[ "def", "_redo_language", "(", "self", ",", "term", ",", "name_mode", ",", "rules", ",", "final_rules1", ",", "final_rules2", ",", "concat", ")", ":", "language_arg", "=", "self", ".", "_language", "(", "term", ",", "name_mode", ")", "return", "self", ".", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._phonetic
Return the Beider-Morse encoding(s) of a term. Parameters ---------- term : str The term to encode via Beider-Morse name_mode : str The name mode of the algorithm: ``gen`` (default), ``ash`` (Ashkenazi), or ``sep`` (Sephardic) rules : tuple ...
abydos/phonetic/_beider_morse.py
def _phonetic( self, term, name_mode, rules, final_rules1, final_rules2, language_arg=0, concat=False, ): """Return the Beider-Morse encoding(s) of a term. Parameters ---------- term : str The term to encode...
def _phonetic( self, term, name_mode, rules, final_rules1, final_rules2, language_arg=0, concat=False, ): """Return the Beider-Morse encoding(s) of a term. Parameters ---------- term : str The term to encode...
[ "Return", "the", "Beider", "-", "Morse", "encoding", "(", "s", ")", "of", "a", "term", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L221-L397
[ "def", "_phonetic", "(", "self", ",", "term", ",", "name_mode", ",", "rules", ",", "final_rules1", ",", "final_rules2", ",", "language_arg", "=", "0", ",", "concat", "=", "False", ",", ")", ":", "term", "=", "term", ".", "replace", "(", "'-'", ",", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._apply_final_rules
Apply a set of final rules to the phonetic encoding. Parameters ---------- phonetic : str The term to which to apply the final rules final_rules : tuple The set of final phonetic transform regexps language_arg : int An integer representing the...
abydos/phonetic/_beider_morse.py
def _apply_final_rules(self, phonetic, final_rules, language_arg, strip): """Apply a set of final rules to the phonetic encoding. Parameters ---------- phonetic : str The term to which to apply the final rules final_rules : tuple The set of final phonetic...
def _apply_final_rules(self, phonetic, final_rules, language_arg, strip): """Apply a set of final rules to the phonetic encoding. Parameters ---------- phonetic : str The term to which to apply the final rules final_rules : tuple The set of final phonetic...
[ "Apply", "a", "set", "of", "final", "rules", "to", "the", "phonetic", "encoding", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L399-L501
[ "def", "_apply_final_rules", "(", "self", ",", "phonetic", ",", "final_rules", ",", "language_arg", ",", "strip", ")", ":", "# optimization to save time", "if", "not", "final_rules", ":", "return", "phonetic", "# expand the result", "phonetic", "=", "self", ".", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._expand_alternates
Expand phonetic alternates separated by |s. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code
abydos/phonetic/_beider_morse.py
def _expand_alternates(self, phonetic): """Expand phonetic alternates separated by |s. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code """ alt_start =...
def _expand_alternates(self, phonetic): """Expand phonetic alternates separated by |s. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code """ alt_start =...
[ "Expand", "phonetic", "alternates", "separated", "by", "|s", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L522-L557
[ "def", "_expand_alternates", "(", "self", ",", "phonetic", ")", ":", "alt_start", "=", "phonetic", ".", "find", "(", "'('", ")", "if", "alt_start", "==", "-", "1", ":", "return", "self", ".", "_normalize_lang_attrs", "(", "phonetic", ",", "False", ")", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._pnums_with_leading_space
Join prefixes & suffixes in cases of alternate phonetic values. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code
abydos/phonetic/_beider_morse.py
def _pnums_with_leading_space(self, phonetic): """Join prefixes & suffixes in cases of alternate phonetic values. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code ...
def _pnums_with_leading_space(self, phonetic): """Join prefixes & suffixes in cases of alternate phonetic values. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code ...
[ "Join", "prefixes", "&", "suffixes", "in", "cases", "of", "alternate", "phonetic", "values", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L559-L588
[ "def", "_pnums_with_leading_space", "(", "self", ",", "phonetic", ")", ":", "alt_start", "=", "phonetic", ".", "find", "(", "'('", ")", "if", "alt_start", "==", "-", "1", ":", "return", "' '", "+", "self", ".", "_phonetic_number", "(", "phonetic", ")", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._phonetic_numbers
Prepare & join phonetic numbers. Split phonetic value on '-', run through _pnums_with_leading_space, and join with ' ' Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phone...
abydos/phonetic/_beider_morse.py
def _phonetic_numbers(self, phonetic): """Prepare & join phonetic numbers. Split phonetic value on '-', run through _pnums_with_leading_space, and join with ' ' Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns --...
def _phonetic_numbers(self, phonetic): """Prepare & join phonetic numbers. Split phonetic value on '-', run through _pnums_with_leading_space, and join with ' ' Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns --...
[ "Prepare", "&", "join", "phonetic", "numbers", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L590-L611
[ "def", "_phonetic_numbers", "(", "self", ",", "phonetic", ")", ":", "phonetic_array", "=", "phonetic", ".", "split", "(", "'-'", ")", "# for names with spaces in them", "result", "=", "' '", ".", "join", "(", "[", "self", ".", "_pnums_with_leading_space", "(", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._remove_dupes
Remove duplicates from a phonetic encoding list. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code
abydos/phonetic/_beider_morse.py
def _remove_dupes(self, phonetic): """Remove duplicates from a phonetic encoding list. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code """ alt_string ...
def _remove_dupes(self, phonetic): """Remove duplicates from a phonetic encoding list. Parameters ---------- phonetic : str A Beider-Morse phonetic encoding Returns ------- str A Beider-Morse phonetic code """ alt_string ...
[ "Remove", "duplicates", "from", "a", "phonetic", "encoding", "list", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L613-L636
[ "def", "_remove_dupes", "(", "self", ",", "phonetic", ")", ":", "alt_string", "=", "phonetic", "alt_array", "=", "alt_string", ".", "split", "(", "'|'", ")", "result", "=", "'|'", "for", "i", "in", "range", "(", "len", "(", "alt_array", ")", ")", ":", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._normalize_lang_attrs
Remove embedded bracketed attributes. This (potentially) bitwise-ands bracketed attributes together and adds to the end. This is applied to a single alternative at a time -- not to a parenthesized list. It removes all embedded bracketed attributes, logically-ands them to...
abydos/phonetic/_beider_morse.py
def _normalize_lang_attrs(self, text, strip): """Remove embedded bracketed attributes. This (potentially) bitwise-ands bracketed attributes together and adds to the end. This is applied to a single alternative at a time -- not to a parenthesized list. It removes all embe...
def _normalize_lang_attrs(self, text, strip): """Remove embedded bracketed attributes. This (potentially) bitwise-ands bracketed attributes together and adds to the end. This is applied to a single alternative at a time -- not to a parenthesized list. It removes all embe...
[ "Remove", "embedded", "bracketed", "attributes", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L638-L690
[ "def", "_normalize_lang_attrs", "(", "self", ",", "text", ",", "strip", ")", ":", "uninitialized", "=", "-", "1", "# all 1's", "attrib", "=", "uninitialized", "while", "'['", "in", "text", ":", "bracket_start", "=", "text", ".", "find", "(", "'['", ")", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._apply_rule_if_compat
Apply a phonetic regex if compatible. tests for compatible language rules to do so, apply the rule, expand the results, and detect alternatives with incompatible attributes then drop each alternative that has incompatible attributes and keep those that are compatible ...
abydos/phonetic/_beider_morse.py
def _apply_rule_if_compat(self, phonetic, target, language_arg): """Apply a phonetic regex if compatible. tests for compatible language rules to do so, apply the rule, expand the results, and detect alternatives with incompatible attributes then drop each alternative that ...
def _apply_rule_if_compat(self, phonetic, target, language_arg): """Apply a phonetic regex if compatible. tests for compatible language rules to do so, apply the rule, expand the results, and detect alternatives with incompatible attributes then drop each alternative that ...
[ "Apply", "a", "phonetic", "regex", "if", "compatible", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L692-L756
[ "def", "_apply_rule_if_compat", "(", "self", ",", "phonetic", ",", "target", ",", "language_arg", ")", ":", "candidate", "=", "phonetic", "+", "target", "if", "'['", "not", "in", "candidate", ":", "# no attributes so we need test no further", "return", "candidate", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse._language_index_from_code
Return the index value for a language code. This returns l_any if more than one code is specified or the code is out of bounds. Parameters ---------- code : int The language code to interpret name_mode : str The name mode of the algorithm: ``gen`...
abydos/phonetic/_beider_morse.py
def _language_index_from_code(self, code, name_mode): """Return the index value for a language code. This returns l_any if more than one code is specified or the code is out of bounds. Parameters ---------- code : int The language code to interpret n...
def _language_index_from_code(self, code, name_mode): """Return the index value for a language code. This returns l_any if more than one code is specified or the code is out of bounds. Parameters ---------- code : int The language code to interpret n...
[ "Return", "the", "index", "value", "for", "a", "language", "code", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L758-L786
[ "def", "_language_index_from_code", "(", "self", ",", "code", ",", "name_mode", ")", ":", "if", "code", "<", "1", "or", "code", ">", "sum", "(", "_LANG_DICT", "[", "_", "]", "for", "_", "in", "BMDATA", "[", "name_mode", "]", "[", "'languages'", "]", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
BeiderMorse.encode
Return the Beider-Morse Phonetic Matching encoding(s) of a term. Parameters ---------- word : str The word to transform language_arg : int The language of the term; supported values include: - ``any`` - ``arabic`` ...
abydos/phonetic/_beider_morse.py
def encode( self, word, language_arg=0, name_mode='gen', match_mode='approx', concat=False, filter_langs=False, ): """Return the Beider-Morse Phonetic Matching encoding(s) of a term. Parameters ---------- word : str ...
def encode( self, word, language_arg=0, name_mode='gen', match_mode='approx', concat=False, filter_langs=False, ): """Return the Beider-Morse Phonetic Matching encoding(s) of a term. Parameters ---------- word : str ...
[ "Return", "the", "Beider", "-", "Morse", "Phonetic", "Matching", "encoding", "(", "s", ")", "of", "a", "term", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L788-L933
[ "def", "encode", "(", "self", ",", "word", ",", "language_arg", "=", "0", ",", "name_mode", "=", "'gen'", ",", "match_mode", "=", "'approx'", ",", "concat", "=", "False", ",", "filter_langs", "=", "False", ",", ")", ":", "word", "=", "normalize", "(", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_strcmp95
Return the strcmp95 similarity of two strings. This is a wrapper for :py:meth:`Strcmp95.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison long_strings : bool Set to True to increase the probability of a match when ...
abydos/distance/_strcmp95.py
def sim_strcmp95(src, tar, long_strings=False): """Return the strcmp95 similarity of two strings. This is a wrapper for :py:meth:`Strcmp95.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison long_strings : bool S...
def sim_strcmp95(src, tar, long_strings=False): """Return the strcmp95 similarity of two strings. This is a wrapper for :py:meth:`Strcmp95.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison long_strings : bool S...
[ "Return", "the", "strcmp95", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_strcmp95.py#L257-L292
[ "def", "sim_strcmp95", "(", "src", ",", "tar", ",", "long_strings", "=", "False", ")", ":", "return", "Strcmp95", "(", ")", ".", "sim", "(", "src", ",", "tar", ",", "long_strings", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_strcmp95
Return the strcmp95 distance between two strings. This is a wrapper for :py:meth:`Strcmp95.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison long_strings : bool Set to True to increase the probability of a match w...
abydos/distance/_strcmp95.py
def dist_strcmp95(src, tar, long_strings=False): """Return the strcmp95 distance between two strings. This is a wrapper for :py:meth:`Strcmp95.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison long_strings : bool ...
def dist_strcmp95(src, tar, long_strings=False): """Return the strcmp95 distance between two strings. This is a wrapper for :py:meth:`Strcmp95.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison long_strings : bool ...
[ "Return", "the", "strcmp95", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_strcmp95.py#L295-L330
[ "def", "dist_strcmp95", "(", "src", ",", "tar", ",", "long_strings", "=", "False", ")", ":", "return", "Strcmp95", "(", ")", ".", "dist", "(", "src", ",", "tar", ",", "long_strings", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Strcmp95.sim
Return the strcmp95 similarity of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison long_strings : bool Set to True to increase the probability of a match when the number ...
abydos/distance/_strcmp95.py
def sim(self, src, tar, long_strings=False): """Return the strcmp95 similarity of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison long_strings : bool Set to True to incre...
def sim(self, src, tar, long_strings=False): """Return the strcmp95 similarity of two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison long_strings : bool Set to True to incre...
[ "Return", "the", "strcmp95", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_strcmp95.py#L94-L254
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ",", "long_strings", "=", "False", ")", ":", "def", "_in_range", "(", "char", ")", ":", "\"\"\"Return True if char is in the range (0, 91).\n\n Parameters\n ----------\n char : str\n ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NRL.encode
Return the Naval Research Laboratory phonetic encoding of a word. Parameters ---------- word : str The word to transform Returns ------- str The NRL phonetic encoding Examples -------- >>> pe = NRL() >>> pe.encode...
abydos/phonetic/_nrl.py
def encode(self, word): """Return the Naval Research Laboratory phonetic encoding of a word. Parameters ---------- word : str The word to transform Returns ------- str The NRL phonetic encoding Examples -------- >...
def encode(self, word): """Return the Naval Research Laboratory phonetic encoding of a word. Parameters ---------- word : str The word to transform Returns ------- str The NRL phonetic encoding Examples -------- >...
[ "Return", "the", "Naval", "Research", "Laboratory", "phonetic", "encoding", "of", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_nrl.py#L435-L519
[ "def", "encode", "(", "self", ",", "word", ")", ":", "def", "_to_regex", "(", "pattern", ",", "left_match", "=", "True", ")", ":", "new_pattern", "=", "''", "replacements", "=", "{", "'#'", ":", "'[AEIOU]+'", ",", "':'", ":", "'[BCDFGHJKLMNPQRSTVWXYZ]*'", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
LCSstr.lcsstr
Return the longest common substring of two strings. Longest common substring (LCSstr). Based on the code from https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_substring :cite:`Wikibooks:2018`. This is licensed Creative Commons: Attribution-ShareAlik...
abydos/distance/_lcsstr.py
def lcsstr(self, src, tar): """Return the longest common substring of two strings. Longest common substring (LCSstr). Based on the code from https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_substring :cite:`Wikibooks:2018`. This is licensed ...
def lcsstr(self, src, tar): """Return the longest common substring of two strings. Longest common substring (LCSstr). Based on the code from https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_substring :cite:`Wikibooks:2018`. This is licensed ...
[ "Return", "the", "longest", "common", "substring", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_lcsstr.py#L44-L95
[ "def", "lcsstr", "(", "self", ",", "src", ",", "tar", ")", ":", "lengths", "=", "np_zeros", "(", "(", "len", "(", "src", ")", "+", "1", ",", "len", "(", "tar", ")", "+", "1", ")", ",", "dtype", "=", "np_int", ")", "longest", ",", "i_longest", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
LCSstr.sim
r"""Return the longest common substring similarity of two strings. Longest common substring similarity (:math:`sim_{LCSstr}`). This employs the LCS function to derive a similarity metric: :math:`sim_{LCSstr}(s,t) = \frac{|LCSstr(s,t)|}{max(|s|, |t|)}` Parameters ---------- ...
abydos/distance/_lcsstr.py
def sim(self, src, tar): r"""Return the longest common substring similarity of two strings. Longest common substring similarity (:math:`sim_{LCSstr}`). This employs the LCS function to derive a similarity metric: :math:`sim_{LCSstr}(s,t) = \frac{|LCSstr(s,t)|}{max(|s|, |t|)}` ...
def sim(self, src, tar): r"""Return the longest common substring similarity of two strings. Longest common substring similarity (:math:`sim_{LCSstr}`). This employs the LCS function to derive a similarity metric: :math:`sim_{LCSstr}(s,t) = \frac{|LCSstr(s,t)|}{max(|s|, |t|)}` ...
[ "r", "Return", "the", "longest", "common", "substring", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_lcsstr.py#L97-L133
[ "def", "sim", "(", "self", ",", "src", ",", "tar", ")", ":", "if", "src", "==", "tar", ":", "return", "1.0", "elif", "not", "src", "or", "not", "tar", ":", "return", "0.0", "return", "len", "(", "self", ".", "lcsstr", "(", "src", ",", "tar", ")...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
needleman_wunsch
Return the Needleman-Wunsch score of two strings. This is a wrapper for :py:meth:`NeedlemanWunsch.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/_needleman_wunsch.py
def needleman_wunsch(src, tar, gap_cost=1, sim_func=sim_ident): """Return the Needleman-Wunsch score of two strings. This is a wrapper for :py:meth:`NeedlemanWunsch.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison ...
def needleman_wunsch(src, tar, gap_cost=1, sim_func=sim_ident): """Return the Needleman-Wunsch score of two strings. This is a wrapper for :py:meth:`NeedlemanWunsch.dist_abs`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison ...
[ "Return", "the", "Needleman", "-", "Wunsch", "score", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_needleman_wunsch.py#L177-L211
[ "def", "needleman_wunsch", "(", "src", ",", "tar", ",", "gap_cost", "=", "1", ",", "sim_func", "=", "sim_ident", ")", ":", "return", "NeedlemanWunsch", "(", ")", ".", "dist_abs", "(", "src", ",", "tar", ",", "gap_cost", ",", "sim_func", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NeedlemanWunsch.sim_matrix
Return the matrix similarity of two strings. With the default parameters, this is identical to sim_ident. It is possible for sim_matrix to return values outside of the range :math:`[0, 1]`, if values outside that range are present in mat, mismatch_cost, or match_cost. Parameter...
abydos/distance/_needleman_wunsch.py
def sim_matrix( src, tar, mat=None, mismatch_cost=0, match_cost=1, symmetric=True, alphabet=None, ): """Return the matrix similarity of two strings. With the default parameters, this is identical to sim_ident. It is possible for sim_ma...
def sim_matrix( src, tar, mat=None, mismatch_cost=0, match_cost=1, symmetric=True, alphabet=None, ): """Return the matrix similarity of two strings. With the default parameters, this is identical to sim_ident. It is possible for sim_ma...
[ "Return", "the", "matrix", "similarity", "of", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_needleman_wunsch.py#L50-L127
[ "def", "sim_matrix", "(", "src", ",", "tar", ",", "mat", "=", "None", ",", "mismatch_cost", "=", "0", ",", "match_cost", "=", "1", ",", "symmetric", "=", "True", ",", "alphabet", "=", "None", ",", ")", ":", "if", "alphabet", ":", "alphabet", "=", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
AlphaSIS.encode
Return the IBM Alpha Search Inquiry System code for a word. A collection is necessary as the return type since there can be multiple values for a single word. But the collection must be ordered since the first value is the primary coding. Parameters ---------- word : st...
abydos/phonetic/_alpha_sis.py
def encode(self, word, max_length=14): """Return the IBM Alpha Search Inquiry System code for a word. A collection is necessary as the return type since there can be multiple values for a single word. But the collection must be ordered since the first value is the primary coding. ...
def encode(self, word, max_length=14): """Return the IBM Alpha Search Inquiry System code for a word. A collection is necessary as the return type since there can be multiple values for a single word. But the collection must be ordered since the first value is the primary coding. ...
[ "Return", "the", "IBM", "Alpha", "Search", "Inquiry", "System", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_alpha_sis.py#L157-L244
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "14", ")", ":", "alpha", "=", "[", "''", "]", "pos", "=", "0", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upper", "(", ")", ")", ")", "w...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
PhoneticSpanish.encode
Return the PhoneticSpanish coding of word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to unlimited) Returns ------- str The PhoneticSpanish code E...
abydos/phonetic/_phonetic_spanish.py
def encode(self, word, max_length=-1): """Return the PhoneticSpanish coding of word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to unlimited) Returns ------- s...
def encode(self, word, max_length=-1): """Return the PhoneticSpanish coding of word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to unlimited) Returns ------- s...
[ "Return", "the", "PhoneticSpanish", "coding", "of", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_phonetic_spanish.py#L53-L97
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "-", "1", ")", ":", "# uppercase, normalize, and decompose, filter to A-Z minus vowels & W", "word", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "word", ".", "upper", "(", ")", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
qgram_fingerprint
Return Q-Gram fingerprint. This is a wrapper for :py:meth:`QGram.fingerprint`. Parameters ---------- phrase : str The string from which to calculate the q-gram fingerprint qval : int The length of each q-gram (by default 2) start_stop : str The start & stop symbol(s) to...
abydos/fingerprint/_qgram.py
def qgram_fingerprint(phrase, qval=2, start_stop='', joiner=''): """Return Q-Gram fingerprint. This is a wrapper for :py:meth:`QGram.fingerprint`. Parameters ---------- phrase : str The string from which to calculate the q-gram fingerprint qval : int The length of each q-gram (...
def qgram_fingerprint(phrase, qval=2, start_stop='', joiner=''): """Return Q-Gram fingerprint. This is a wrapper for :py:meth:`QGram.fingerprint`. Parameters ---------- phrase : str The string from which to calculate the q-gram fingerprint qval : int The length of each q-gram (...
[ "Return", "Q", "-", "Gram", "fingerprint", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_qgram.py#L87-L119
[ "def", "qgram_fingerprint", "(", "phrase", ",", "qval", "=", "2", ",", "start_stop", "=", "''", ",", "joiner", "=", "''", ")", ":", "return", "QGram", "(", ")", ".", "fingerprint", "(", "phrase", ",", "qval", ",", "start_stop", ",", "joiner", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
QGram.fingerprint
Return Q-Gram fingerprint. Parameters ---------- phrase : str The string from which to calculate the q-gram fingerprint qval : int The length of each q-gram (by default 2) start_stop : str The start & stop symbol(s) to concatenate on either en...
abydos/fingerprint/_qgram.py
def fingerprint(self, phrase, qval=2, start_stop='', joiner=''): """Return Q-Gram fingerprint. Parameters ---------- phrase : str The string from which to calculate the q-gram fingerprint qval : int The length of each q-gram (by default 2) start_s...
def fingerprint(self, phrase, qval=2, start_stop='', joiner=''): """Return Q-Gram fingerprint. Parameters ---------- phrase : str The string from which to calculate the q-gram fingerprint qval : int The length of each q-gram (by default 2) start_s...
[ "Return", "Q", "-", "Gram", "fingerprint", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/fingerprint/_qgram.py#L49-L84
[ "def", "fingerprint", "(", "self", ",", "phrase", ",", "qval", "=", "2", ",", "start_stop", "=", "''", ",", "joiner", "=", "''", ")", ":", "phrase", "=", "unicode_normalize", "(", "'NFKD'", ",", "text_type", "(", "phrase", ".", "strip", "(", ")", "."...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
NCDbwtrle.dist
Return the NCD between two strings using BWT plus RLE. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison Returns ------- float Compression distance Examples --...
abydos/distance/_ncd_bwtrle.py
def dist(self, src, tar): """Return the NCD between two strings using BWT plus RLE. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison Returns ------- float Compression ...
def dist(self, src, tar): """Return the NCD between two strings using BWT plus RLE. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison Returns ------- float Compression ...
[ "Return", "the", "NCD", "between", "two", "strings", "using", "BWT", "plus", "RLE", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_ncd_bwtrle.py#L48-L87
[ "def", "dist", "(", "self", ",", "src", ",", "tar", ")", ":", "if", "src", "==", "tar", ":", "return", "0.0", "src_comp", "=", "self", ".", "_rle", ".", "encode", "(", "self", ".", "_bwt", ".", "encode", "(", "src", ")", ")", "tar_comp", "=", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dm_soundex
Return the Daitch-Mokotoff Soundex code for a word. This is a wrapper for :py:meth:`DaitchMokotoff.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 6; must be between 6 and 64) zero_pad : bool ...
abydos/phonetic/_daitch_mokotoff.py
def dm_soundex(word, max_length=6, zero_pad=True): """Return the Daitch-Mokotoff Soundex code for a word. This is a wrapper for :py:meth:`DaitchMokotoff.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to...
def dm_soundex(word, max_length=6, zero_pad=True): """Return the Daitch-Mokotoff Soundex code for a word. This is a wrapper for :py:meth:`DaitchMokotoff.encode`. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to...
[ "Return", "the", "Daitch", "-", "Mokotoff", "Soundex", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_daitch_mokotoff.py#L361-L397
[ "def", "dm_soundex", "(", "word", ",", "max_length", "=", "6", ",", "zero_pad", "=", "True", ")", ":", "return", "DaitchMokotoff", "(", ")", ".", "encode", "(", "word", ",", "max_length", ",", "zero_pad", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
DaitchMokotoff.encode
Return the Daitch-Mokotoff Soundex code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 6; must be between 6 and 64) zero_pad : bool Pad the end of th...
abydos/phonetic/_daitch_mokotoff.py
def encode(self, word, max_length=6, zero_pad=True): """Return the Daitch-Mokotoff Soundex code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 6; must be between 6 ...
def encode(self, word, max_length=6, zero_pad=True): """Return the Daitch-Mokotoff Soundex code for a word. Parameters ---------- word : str The word to transform max_length : int The length of the code returned (defaults to 6; must be between 6 ...
[ "Return", "the", "Daitch", "-", "Mokotoff", "Soundex", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_daitch_mokotoff.py#L260-L358
[ "def", "encode", "(", "self", ",", "word", ",", "max_length", "=", "6", ",", "zero_pad", "=", "True", ")", ":", "dms", "=", "[", "''", "]", "# initialize empty code list", "# Require a max_length of at least 6 and not more than 64", "if", "max_length", "!=", "-", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Norphone.encode
Return the Norphone code. Parameters ---------- word : str The word to transform Returns ------- str The Norphone code Examples -------- >>> pe = Norphone() >>> pe.encode('Hansen') 'HNSN' >>> pe.en...
abydos/phonetic/_norphone.py
def encode(self, word): """Return the Norphone code. Parameters ---------- word : str The word to transform Returns ------- str The Norphone code Examples -------- >>> pe = Norphone() >>> pe.encode('Hansen...
def encode(self, word): """Return the Norphone code. Parameters ---------- word : str The word to transform Returns ------- str The Norphone code Examples -------- >>> pe = Norphone() >>> pe.encode('Hansen...
[ "Return", "the", "Norphone", "code", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_norphone.py#L73-L155
[ "def", "encode", "(", "self", ",", "word", ")", ":", "word", "=", "word", ".", "upper", "(", ")", "code", "=", "''", "skip", "=", "0", "if", "word", "[", "0", ":", "2", "]", "==", "'AA'", ":", "code", "=", "'Å'", "skip", "=", "2", "elif", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.to_tuple
Cast to tuple. Returns ------- tuple The confusion table as a 4-tuple (tp, tn, fp, fn) Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) >>> ct.to_tuple() (120, 60, 20, 30)
abydos/stats/_confusion_table.py
def to_tuple(self): """Cast to tuple. Returns ------- tuple The confusion table as a 4-tuple (tp, tn, fp, fn) Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) >>> ct.to_tuple() (120, 60, 20, 30) """ return sel...
def to_tuple(self): """Cast to tuple. Returns ------- tuple The confusion table as a 4-tuple (tp, tn, fp, fn) Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) >>> ct.to_tuple() (120, 60, 20, 30) """ return sel...
[ "Cast", "to", "tuple", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L217-L232
[ "def", "to_tuple", "(", "self", ")", ":", "return", "self", ".", "_tp", ",", "self", ".", "_tn", ",", "self", ".", "_fp", ",", "self", ".", "_fn" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.to_dict
Cast to dict. Returns ------- dict The confusion table as a dict Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) >>> import pprint >>> pprint.pprint(ct.to_dict()) {'fn': 30, 'fp': 20, 'tn': 60, 'tp': 120}
abydos/stats/_confusion_table.py
def to_dict(self): """Cast to dict. Returns ------- dict The confusion table as a dict Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) >>> import pprint >>> pprint.pprint(ct.to_dict()) {'fn': 30, 'fp': 20, 'tn': 60, '...
def to_dict(self): """Cast to dict. Returns ------- dict The confusion table as a dict Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) >>> import pprint >>> pprint.pprint(ct.to_dict()) {'fn': 30, 'fp': 20, 'tn': 60, '...
[ "Cast", "to", "dict", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L234-L250
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "'tp'", ":", "self", ".", "_tp", ",", "'tn'", ":", "self", ".", "_tn", ",", "'fp'", ":", "self", ".", "_fp", ",", "'fn'", ":", "self", ".", "_fn", "}" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.population
Return population, N. Returns ------- int The population (N) of the confusion table Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) >>> ct.population() 230
abydos/stats/_confusion_table.py
def population(self): """Return population, N. Returns ------- int The population (N) of the confusion table Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) >>> ct.population() 230 """ return self._tp + self....
def population(self): """Return population, N. Returns ------- int The population (N) of the confusion table Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) >>> ct.population() 230 """ return self._tp + self....
[ "Return", "population", "N", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L422-L437
[ "def", "population", "(", "self", ")", ":", "return", "self", ".", "_tp", "+", "self", ".", "_tn", "+", "self", ".", "_fp", "+", "self", ".", "_fn" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.precision
r"""Return precision. Precision is defined as :math:`\frac{tp}{tp + fp}` AKA positive predictive value (PPV) Cf. https://en.wikipedia.org/wiki/Precision_and_recall Cf. https://en.wikipedia.org/wiki/Information_retrieval#Precision Returns ------- float ...
abydos/stats/_confusion_table.py
def precision(self): r"""Return precision. Precision is defined as :math:`\frac{tp}{tp + fp}` AKA positive predictive value (PPV) Cf. https://en.wikipedia.org/wiki/Precision_and_recall Cf. https://en.wikipedia.org/wiki/Information_retrieval#Precision Returns ...
def precision(self): r"""Return precision. Precision is defined as :math:`\frac{tp}{tp + fp}` AKA positive predictive value (PPV) Cf. https://en.wikipedia.org/wiki/Precision_and_recall Cf. https://en.wikipedia.org/wiki/Information_retrieval#Precision Returns ...
[ "r", "Return", "precision", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L439-L464
[ "def", "precision", "(", "self", ")", ":", "if", "self", ".", "_tp", "+", "self", ".", "_fp", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "return", "self", ".", "_tp", "/", "(", "self", ".", "_tp", "+", "self", ".", "_fp", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.precision_gain
r"""Return gain in precision. The gain in precision is defined as: :math:`G(precision) = \frac{precision}{random~ precision}` Cf. https://en.wikipedia.org/wiki/Gain_(information_retrieval) Returns ------- float The gain in precision of the confusion table ...
abydos/stats/_confusion_table.py
def precision_gain(self): r"""Return gain in precision. The gain in precision is defined as: :math:`G(precision) = \frac{precision}{random~ precision}` Cf. https://en.wikipedia.org/wiki/Gain_(information_retrieval) Returns ------- float The gain in ...
def precision_gain(self): r"""Return gain in precision. The gain in precision is defined as: :math:`G(precision) = \frac{precision}{random~ precision}` Cf. https://en.wikipedia.org/wiki/Gain_(information_retrieval) Returns ------- float The gain in ...
[ "r", "Return", "gain", "in", "precision", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L466-L489
[ "def", "precision_gain", "(", "self", ")", ":", "if", "self", ".", "population", "(", ")", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "random_precision", "=", "self", ".", "cond_pos_pop", "(", ")", "/", "self", ".", "population", "(", ")", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.recall
r"""Return recall. Recall is defined as :math:`\frac{tp}{tp + fn}` AKA sensitivity AKA true positive rate (TPR) Cf. https://en.wikipedia.org/wiki/Precision_and_recall Cf. https://en.wikipedia.org/wiki/Sensitivity_(test) Cf. https://en.wikipedia.org/wiki/Information_...
abydos/stats/_confusion_table.py
def recall(self): r"""Return recall. Recall is defined as :math:`\frac{tp}{tp + fn}` AKA sensitivity AKA true positive rate (TPR) Cf. https://en.wikipedia.org/wiki/Precision_and_recall Cf. https://en.wikipedia.org/wiki/Sensitivity_(test) Cf. https://en.wikip...
def recall(self): r"""Return recall. Recall is defined as :math:`\frac{tp}{tp + fn}` AKA sensitivity AKA true positive rate (TPR) Cf. https://en.wikipedia.org/wiki/Precision_and_recall Cf. https://en.wikipedia.org/wiki/Sensitivity_(test) Cf. https://en.wikip...
[ "r", "Return", "recall", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L491-L520
[ "def", "recall", "(", "self", ")", ":", "if", "self", ".", "_tp", "+", "self", ".", "_fn", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "return", "self", ".", "_tp", "/", "(", "self", ".", "_tp", "+", "self", ".", "_fn", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.specificity
r"""Return specificity. Specificity is defined as :math:`\frac{tn}{tn + fp}` AKA true negative rate (TNR) Cf. https://en.wikipedia.org/wiki/Specificity_(tests) Returns ------- float The specificity of the confusion table Example ------- ...
abydos/stats/_confusion_table.py
def specificity(self): r"""Return specificity. Specificity is defined as :math:`\frac{tn}{tn + fp}` AKA true negative rate (TNR) Cf. https://en.wikipedia.org/wiki/Specificity_(tests) Returns ------- float The specificity of the confusion table ...
def specificity(self): r"""Return specificity. Specificity is defined as :math:`\frac{tn}{tn + fp}` AKA true negative rate (TNR) Cf. https://en.wikipedia.org/wiki/Specificity_(tests) Returns ------- float The specificity of the confusion table ...
[ "r", "Return", "specificity", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L522-L545
[ "def", "specificity", "(", "self", ")", ":", "if", "self", ".", "_tn", "+", "self", ".", "_fp", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "return", "self", ".", "_tn", "/", "(", "self", ".", "_tn", "+", "self", ".", "_fp", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.npv
r"""Return negative predictive value (NPV). NPV is defined as :math:`\frac{tn}{tn + fn}` Cf. https://en.wikipedia.org/wiki/Negative_predictive_value Returns ------- float The negative predictive value of the confusion table Example ------- ...
abydos/stats/_confusion_table.py
def npv(self): r"""Return negative predictive value (NPV). NPV is defined as :math:`\frac{tn}{tn + fn}` Cf. https://en.wikipedia.org/wiki/Negative_predictive_value Returns ------- float The negative predictive value of the confusion table Example ...
def npv(self): r"""Return negative predictive value (NPV). NPV is defined as :math:`\frac{tn}{tn + fn}` Cf. https://en.wikipedia.org/wiki/Negative_predictive_value Returns ------- float The negative predictive value of the confusion table Example ...
[ "r", "Return", "negative", "predictive", "value", "(", "NPV", ")", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L547-L568
[ "def", "npv", "(", "self", ")", ":", "if", "self", ".", "_tn", "+", "self", ".", "_fn", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "return", "self", ".", "_tn", "/", "(", "self", ".", "_tn", "+", "self", ".", "_fn", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.fallout
r"""Return fall-out. Fall-out is defined as :math:`\frac{fp}{fp + tn}` AKA false positive rate (FPR) Cf. https://en.wikipedia.org/wiki/Information_retrieval#Fall-out Returns ------- float The fall-out of the confusion table Example -------...
abydos/stats/_confusion_table.py
def fallout(self): r"""Return fall-out. Fall-out is defined as :math:`\frac{fp}{fp + tn}` AKA false positive rate (FPR) Cf. https://en.wikipedia.org/wiki/Information_retrieval#Fall-out Returns ------- float The fall-out of the confusion table ...
def fallout(self): r"""Return fall-out. Fall-out is defined as :math:`\frac{fp}{fp + tn}` AKA false positive rate (FPR) Cf. https://en.wikipedia.org/wiki/Information_retrieval#Fall-out Returns ------- float The fall-out of the confusion table ...
[ "r", "Return", "fall", "-", "out", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L570-L593
[ "def", "fallout", "(", "self", ")", ":", "if", "self", ".", "_fp", "+", "self", ".", "_tn", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "return", "self", ".", "_fp", "/", "(", "self", ".", "_fp", "+", "self", ".", "_tn", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.fdr
r"""Return false discovery rate (FDR). False discovery rate is defined as :math:`\frac{fp}{fp + tp}` Cf. https://en.wikipedia.org/wiki/False_discovery_rate Returns ------- float The false discovery rate of the confusion table Example ------- ...
abydos/stats/_confusion_table.py
def fdr(self): r"""Return false discovery rate (FDR). False discovery rate is defined as :math:`\frac{fp}{fp + tp}` Cf. https://en.wikipedia.org/wiki/False_discovery_rate Returns ------- float The false discovery rate of the confusion table Example...
def fdr(self): r"""Return false discovery rate (FDR). False discovery rate is defined as :math:`\frac{fp}{fp + tp}` Cf. https://en.wikipedia.org/wiki/False_discovery_rate Returns ------- float The false discovery rate of the confusion table Example...
[ "r", "Return", "false", "discovery", "rate", "(", "FDR", ")", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L595-L616
[ "def", "fdr", "(", "self", ")", ":", "if", "self", ".", "_fp", "+", "self", ".", "_tp", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "return", "self", ".", "_fp", "/", "(", "self", ".", "_fp", "+", "self", ".", "_tp", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.accuracy
r"""Return accuracy. Accuracy is defined as :math:`\frac{tp + tn}{population}` Cf. https://en.wikipedia.org/wiki/Accuracy Returns ------- float The accuracy of the confusion table Example ------- >>> ct = ConfusionTable(120, 60, 20, 30) ...
abydos/stats/_confusion_table.py
def accuracy(self): r"""Return accuracy. Accuracy is defined as :math:`\frac{tp + tn}{population}` Cf. https://en.wikipedia.org/wiki/Accuracy Returns ------- float The accuracy of the confusion table Example ------- >>> ct = Confusi...
def accuracy(self): r"""Return accuracy. Accuracy is defined as :math:`\frac{tp + tn}{population}` Cf. https://en.wikipedia.org/wiki/Accuracy Returns ------- float The accuracy of the confusion table Example ------- >>> ct = Confusi...
[ "r", "Return", "accuracy", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L618-L639
[ "def", "accuracy", "(", "self", ")", ":", "if", "self", ".", "population", "(", ")", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "return", "(", "self", ".", "_tp", "+", "self", ".", "_tn", ")", "/", "self", ".", "population", "(", ")" ]
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.accuracy_gain
r"""Return gain in accuracy. The gain in accuracy is defined as: :math:`G(accuracy) = \frac{accuracy}{random~ accuracy}` Cf. https://en.wikipedia.org/wiki/Gain_(information_retrieval) Returns ------- float The gain in accuracy of the confusion table ...
abydos/stats/_confusion_table.py
def accuracy_gain(self): r"""Return gain in accuracy. The gain in accuracy is defined as: :math:`G(accuracy) = \frac{accuracy}{random~ accuracy}` Cf. https://en.wikipedia.org/wiki/Gain_(information_retrieval) Returns ------- float The gain in accura...
def accuracy_gain(self): r"""Return gain in accuracy. The gain in accuracy is defined as: :math:`G(accuracy) = \frac{accuracy}{random~ accuracy}` Cf. https://en.wikipedia.org/wiki/Gain_(information_retrieval) Returns ------- float The gain in accura...
[ "r", "Return", "gain", "in", "accuracy", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L641-L666
[ "def", "accuracy_gain", "(", "self", ")", ":", "if", "self", ".", "population", "(", ")", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "random_accuracy", "=", "(", "self", ".", "cond_pos_pop", "(", ")", "/", "self", ".", "population", "(", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.pr_lmean
r"""Return logarithmic mean of precision & recall. The logarithmic mean is: 0 if either precision or recall is 0, the precision if they are equal, otherwise :math:`\frac{precision - recall} {ln(precision) - ln(recall)}` Cf. https://en.wikipedia.org/wiki/Logarithmic_mean...
abydos/stats/_confusion_table.py
def pr_lmean(self): r"""Return logarithmic mean of precision & recall. The logarithmic mean is: 0 if either precision or recall is 0, the precision if they are equal, otherwise :math:`\frac{precision - recall} {ln(precision) - ln(recall)}` Cf. https://en.wikiped...
def pr_lmean(self): r"""Return logarithmic mean of precision & recall. The logarithmic mean is: 0 if either precision or recall is 0, the precision if they are equal, otherwise :math:`\frac{precision - recall} {ln(precision) - ln(recall)}` Cf. https://en.wikiped...
[ "r", "Return", "logarithmic", "mean", "of", "precision", "&", "recall", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L844-L873
[ "def", "pr_lmean", "(", "self", ")", ":", "precision", "=", "self", ".", "precision", "(", ")", "recall", "=", "self", ".", "recall", "(", ")", "if", "not", "precision", "or", "not", "recall", ":", "return", "0.0", "elif", "precision", "==", "recall", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.fbeta_score
r"""Return :math:`F_{\beta}` score. :math:`F_{\beta}` for a positive real value :math:`\beta` "measures the effectiveness of retrieval with respect to a user who attaches :math:`\beta` times as much importance to recall as precision" (van Rijsbergen 1979) :math:`F_{\beta}` scor...
abydos/stats/_confusion_table.py
def fbeta_score(self, beta=1.0): r"""Return :math:`F_{\beta}` score. :math:`F_{\beta}` for a positive real value :math:`\beta` "measures the effectiveness of retrieval with respect to a user who attaches :math:`\beta` times as much importance to recall as precision" (van Rijsber...
def fbeta_score(self, beta=1.0): r"""Return :math:`F_{\beta}` score. :math:`F_{\beta}` for a positive real value :math:`\beta` "measures the effectiveness of retrieval with respect to a user who attaches :math:`\beta` times as much importance to recall as precision" (van Rijsber...
[ "r", "Return", ":", "math", ":", "F_", "{", "\\", "beta", "}", "score", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L1072-L1119
[ "def", "fbeta_score", "(", "self", ",", "beta", "=", "1.0", ")", ":", "if", "beta", "<=", "0", ":", "raise", "AttributeError", "(", "'Beta must be a positive real value.'", ")", "precision", "=", "self", ".", "precision", "(", ")", "recall", "=", "self", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.mcc
r"""Return Matthews correlation coefficient (MCC). The Matthews correlation coefficient is defined in :cite:`Matthews:1975` as: :math:`\frac{(tp \cdot tn) - (fp \cdot fn)} {\sqrt{(tp + fp)(tp + fn)(tn + fp)(tn + fn)}}` This is equivalent to the geometric mean of informedness an...
abydos/stats/_confusion_table.py
def mcc(self): r"""Return Matthews correlation coefficient (MCC). The Matthews correlation coefficient is defined in :cite:`Matthews:1975` as: :math:`\frac{(tp \cdot tn) - (fp \cdot fn)} {\sqrt{(tp + fp)(tp + fn)(tn + fp)(tn + fn)}}` This is equivalent to the geometric ...
def mcc(self): r"""Return Matthews correlation coefficient (MCC). The Matthews correlation coefficient is defined in :cite:`Matthews:1975` as: :math:`\frac{(tp \cdot tn) - (fp \cdot fn)} {\sqrt{(tp + fp)(tp + fn)(tn + fp)(tn + fn)}}` This is equivalent to the geometric ...
[ "r", "Return", "Matthews", "correlation", "coefficient", "(", "MCC", ")", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L1263-L1302
[ "def", "mcc", "(", "self", ")", ":", "if", "(", "(", "(", "self", ".", "_tp", "+", "self", ".", "_fp", ")", "*", "(", "self", ".", "_tp", "+", "self", ".", "_fn", ")", "*", "(", "self", ".", "_tn", "+", "self", ".", "_fp", ")", "*", "(", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.significance
r"""Return the significance, :math:`\chi^{2}`. Significance is defined as: :math:`\chi^{2} = \frac{(tp \cdot tn - fp \cdot fn)^{2} (tp + tn + fp + fn)} {((tp + fp)(tp + fn)(tn + fp)(tn + fn)}` Also: :math:`\chi^{2} = MCC^{2} \cdot n` Cf. https://en.wikipedia.org/wiki/P...
abydos/stats/_confusion_table.py
def significance(self): r"""Return the significance, :math:`\chi^{2}`. Significance is defined as: :math:`\chi^{2} = \frac{(tp \cdot tn - fp \cdot fn)^{2} (tp + tn + fp + fn)} {((tp + fp)(tp + fn)(tn + fp)(tn + fn)}` Also: :math:`\chi^{2} = MCC^{2} \cdot n` Cf....
def significance(self): r"""Return the significance, :math:`\chi^{2}`. Significance is defined as: :math:`\chi^{2} = \frac{(tp \cdot tn - fp \cdot fn)^{2} (tp + tn + fp + fn)} {((tp + fp)(tp + fn)(tn + fp)(tn + fn)}` Also: :math:`\chi^{2} = MCC^{2} \cdot n` Cf....
[ "r", "Return", "the", "significance", ":", "math", ":", "\\", "chi^", "{", "2", "}", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L1304-L1345
[ "def", "significance", "(", "self", ")", ":", "if", "(", "(", "(", "self", ".", "_tp", "+", "self", ".", "_fp", ")", "*", "(", "self", ".", "_tp", "+", "self", ".", "_fn", ")", "*", "(", "self", ".", "_tn", "+", "self", ".", "_fp", ")", "*"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
ConfusionTable.kappa_statistic
r"""Return κ statistic. The κ statistic is defined as: :math:`\kappa = \frac{accuracy - random~ accuracy} {1 - random~ accuracy}` The κ statistic compares the performance of the classifier relative to the performance of a random classifier. :math:`\kappa` = 0 indicates ...
abydos/stats/_confusion_table.py
def kappa_statistic(self): r"""Return κ statistic. The κ statistic is defined as: :math:`\kappa = \frac{accuracy - random~ accuracy} {1 - random~ accuracy}` The κ statistic compares the performance of the classifier relative to the performance of a random classifier. :m...
def kappa_statistic(self): r"""Return κ statistic. The κ statistic is defined as: :math:`\kappa = \frac{accuracy - random~ accuracy} {1 - random~ accuracy}` The κ statistic compares the performance of the classifier relative to the performance of a random classifier. :m...
[ "r", "Return", "κ", "statistic", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L1347-L1378
[ "def", "kappa_statistic", "(", "self", ")", ":", "if", "self", ".", "population", "(", ")", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "random_accuracy", "=", "(", "(", "self", ".", "_tn", "+", "self", ".", "_fp", ")", "*", "(", "self", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
DoubleMetaphone.encode
Return the Double Metaphone code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length of the returned Double Metaphone codes (defaults to unlmited, but in Philips' original implementation this was 4) ...
abydos/phonetic/_double_metaphone.py
def encode(self, word, max_length=-1): """Return the Double Metaphone code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length of the returned Double Metaphone codes (defaults to unlmited, but...
def encode(self, word, max_length=-1): """Return the Double Metaphone code for a word. Parameters ---------- word : str The word to transform max_length : int The maximum length of the returned Double Metaphone codes (defaults to unlmited, but...
[ "Return", "the", "Double", "Metaphone", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_double_metaphone.py#L43-L958
[ "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", ")", "primary", "=", "''", "sec...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
CLEFGerman.stem
Return CLEF German stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = CLEFGerman() >>> stmr.stem('lesen') 'lese' >>> stmr.stem('graue...
abydos/stemmer/_clef_german.py
def stem(self, word): """Return CLEF German stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = CLEFGerman() >>> stmr.stem('lesen') 'l...
def stem(self, word): """Return CLEF German stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = CLEFGerman() >>> stmr.stem('lesen') 'l...
[ "Return", "CLEF", "German", "stem", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_clef_german.py#L48-L90
[ "def", "stem", "(", "self", ",", "word", ")", ":", "# lowercase, normalize, and compose", "word", "=", "normalize", "(", "'NFC'", ",", "text_type", "(", "word", ".", "lower", "(", ")", ")", ")", "# remove umlauts", "word", "=", "word", ".", "translate", "(...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Phonet.encode
Return the phonet code for a word. Parameters ---------- word : str The word to transform mode : int The ponet variant to employ (1 or 2) lang : str ``de`` (default) for German, ``none`` for no language Returns ------- ...
abydos/phonetic/_phonet.py
def encode(self, word, mode=1, lang='de'): """Return the phonet code for a word. Parameters ---------- word : str The word to transform mode : int The ponet variant to employ (1 or 2) lang : str ``de`` (default) for German, ``none`` fo...
def encode(self, word, mode=1, lang='de'): """Return the phonet code for a word. Parameters ---------- word : str The word to transform mode : int The ponet variant to employ (1 or 2) lang : str ``de`` (default) for German, ``none`` fo...
[ "Return", "the", "phonet", "code", "for", "a", "word", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_phonet.py#L1075-L1722
[ "def", "encode", "(", "self", ",", "word", ",", "mode", "=", "1", ",", "lang", "=", "'de'", ")", ":", "phonet_hash", "=", "Counter", "(", ")", "alpha_pos", "=", "Counter", "(", ")", "phonet_hash_1", "=", "Counter", "(", ")", "phonet_hash_2", "=", "Co...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SnowballDanish.stem
Return Snowball Danish stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = SnowballDanish() >>> stmr.stem('underviser') 'undervis' >>>...
abydos/stemmer/_snowball_danish.py
def stem(self, word): """Return Snowball Danish stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = SnowballDanish() >>> stmr.stem('underviser...
def stem(self, word): """Return Snowball Danish stem. Parameters ---------- word : str The word to stem Returns ------- str Word stem Examples -------- >>> stmr = SnowballDanish() >>> stmr.stem('underviser...
[ "Return", "Snowball", "Danish", "stem", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball_danish.py#L71-L174
[ "def", "stem", "(", "self", ",", "word", ")", ":", "# lowercase, normalize, and compose", "word", "=", "normalize", "(", "'NFC'", ",", "text_type", "(", "word", ".", "lower", "(", ")", ")", ")", "r1_start", "=", "min", "(", "max", "(", "3", ",", "self"...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
SnowballGerman.stem
Return Snowball German stem. Parameters ---------- word : str The word to stem alternate_vowels : bool Composes ae as ä, oe as ö, and ue as ü before running the algorithm Returns ------- str Word stem Examples ...
abydos/stemmer/_snowball_german.py
def stem(self, word, alternate_vowels=False): """Return Snowball German stem. Parameters ---------- word : str The word to stem alternate_vowels : bool Composes ae as ä, oe as ö, and ue as ü before running the algorithm Returns ------- ...
def stem(self, word, alternate_vowels=False): """Return Snowball German stem. Parameters ---------- word : str The word to stem alternate_vowels : bool Composes ae as ä, oe as ö, and ue as ü before running the algorithm Returns ------- ...
[ "Return", "Snowball", "German", "stem", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stemmer/_snowball_german.py#L51-L191
[ "def", "stem", "(", "self", ",", "word", ",", "alternate_vowels", "=", "False", ")", ":", "# lowercase, normalize, and compose", "word", "=", "normalize", "(", "'NFC'", ",", "word", ".", "lower", "(", ")", ")", "word", "=", "word", ".", "replace", "(", "...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Sift4Simplest.dist_abs
Return the "simplest" Sift4 distance between two terms. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison max_offset : int The number of characters to search for matching letters Retur...
abydos/distance/_sift4_simplest.py
def dist_abs(self, src, tar, max_offset=5): """Return the "simplest" Sift4 distance between two terms. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison max_offset : int The number of c...
def dist_abs(self, src, tar, max_offset=5): """Return the "simplest" Sift4 distance between two terms. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison max_offset : int The number of c...
[ "Return", "the", "simplest", "Sift4", "distance", "between", "two", "terms", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_sift4_simplest.py#L45-L119
[ "def", "dist_abs", "(", "self", ",", "src", ",", "tar", ",", "max_offset", "=", "5", ")", ":", "if", "not", "src", ":", "return", "len", "(", "tar", ")", "if", "not", "tar", ":", "return", "len", "(", "src", ")", "src_len", "=", "len", "(", "sr...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
typo
Return the typo distance between two strings. This is a wrapper for :py:meth:`Typo.typo`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison metric : str Supported values include: ``euclidean``, ``manhattan``, ``l...
abydos/distance/_typo.py
def typo(src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY'): """Return the typo distance between two strings. This is a wrapper for :py:meth:`Typo.typo`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison m...
def typo(src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY'): """Return the typo distance between two strings. This is a wrapper for :py:meth:`Typo.typo`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison m...
[ "Return", "the", "typo", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_typo.py#L330-L389
[ "def", "typo", "(", "src", ",", "tar", ",", "metric", "=", "'euclidean'", ",", "cost", "=", "(", "1", ",", "1", ",", "0.5", ",", "0.5", ")", ",", "layout", "=", "'QWERTY'", ")", ":", "return", "Typo", "(", ")", ".", "dist_abs", "(", "src", ",",...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
dist_typo
Return the normalized typo distance between two strings. This is a wrapper for :py:meth:`Typo.dist`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison metric : str Supported values include: ``euclidean``, ``manhattan``, ...
abydos/distance/_typo.py
def dist_typo( src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY' ): """Return the normalized typo distance between two strings. This is a wrapper for :py:meth:`Typo.dist`. Parameters ---------- src : str Source string for comparison tar : str Target strin...
def dist_typo( src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY' ): """Return the normalized typo distance between two strings. This is a wrapper for :py:meth:`Typo.dist`. Parameters ---------- src : str Source string for comparison tar : str Target strin...
[ "Return", "the", "normalized", "typo", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_typo.py#L392-L435
[ "def", "dist_typo", "(", "src", ",", "tar", ",", "metric", "=", "'euclidean'", ",", "cost", "=", "(", "1", ",", "1", ",", "0.5", ",", "0.5", ")", ",", "layout", "=", "'QWERTY'", ")", ":", "return", "Typo", "(", ")", ".", "dist", "(", "src", ","...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
sim_typo
Return the normalized typo similarity between two strings. This is a wrapper for :py:meth:`Typo.sim`. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison metric : str Supported values include: ``euclidean``, ``manhattan``,...
abydos/distance/_typo.py
def sim_typo( src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY' ): """Return the normalized typo similarity between two strings. This is a wrapper for :py:meth:`Typo.sim`. Parameters ---------- src : str Source string for comparison tar : str Target strin...
def sim_typo( src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY' ): """Return the normalized typo similarity between two strings. This is a wrapper for :py:meth:`Typo.sim`. Parameters ---------- src : str Source string for comparison tar : str Target strin...
[ "Return", "the", "normalized", "typo", "similarity", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_typo.py#L438-L481
[ "def", "sim_typo", "(", "src", ",", "tar", ",", "metric", "=", "'euclidean'", ",", "cost", "=", "(", "1", ",", "1", ",", "0.5", ",", "0.5", ")", ",", "layout", "=", "'QWERTY'", ")", ":", "return", "Typo", "(", ")", ".", "sim", "(", "src", ",", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Typo.dist_abs
Return the typo distance between two strings. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison metric : str Supported values include: ``euclidean``, ``manhattan``, ``log-euclidean`...
abydos/distance/_typo.py
def dist_abs( self, src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY', ): """Return the typo distance between two strings. Parameters ---------- src : str Source string for comparison tar : str ...
def dist_abs( self, src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY', ): """Return the typo distance between two strings. Parameters ---------- src : str Source string for comparison tar : str ...
[ "Return", "the", "typo", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_typo.py#L94-L271
[ "def", "dist_abs", "(", "self", ",", "src", ",", "tar", ",", "metric", "=", "'euclidean'", ",", "cost", "=", "(", "1", ",", "1", ",", "0.5", ",", "0.5", ")", ",", "layout", "=", "'QWERTY'", ",", ")", ":", "ins_cost", ",", "del_cost", ",", "sub_co...
165466b3ff6afd8024a4c8660421b0c4e7773db9
valid
Typo.dist
Return the normalized typo distance between two strings. This is typo distance, normalized to [0, 1]. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison metric : str Supported values in...
abydos/distance/_typo.py
def dist( self, src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY', ): """Return the normalized typo distance between two strings. This is typo distance, normalized to [0, 1]. Parameters ---------- src : str ...
def dist( self, src, tar, metric='euclidean', cost=(1, 1, 0.5, 0.5), layout='QWERTY', ): """Return the normalized typo distance between two strings. This is typo distance, normalized to [0, 1]. Parameters ---------- src : str ...
[ "Return", "the", "normalized", "typo", "distance", "between", "two", "strings", "." ]
chrislit/abydos
python
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/distance/_typo.py#L273-L327
[ "def", "dist", "(", "self", ",", "src", ",", "tar", ",", "metric", "=", "'euclidean'", ",", "cost", "=", "(", "1", ",", "1", ",", "0.5", ",", "0.5", ")", ",", "layout", "=", "'QWERTY'", ",", ")", ":", "if", "src", "==", "tar", ":", "return", ...
165466b3ff6afd8024a4c8660421b0c4e7773db9