commit 9cf2430e9df092935b513b1be6b28ff72020a839
parent ced11be761b4898fa042fba45e17e68c4d5e1ccf
Author: amin <dev@aminmesbah.com>
Date: Mon, 1 Feb 2016 00:11:00 +0000
add docstrings
FossilOrigin-Name: ffe845ddf842fdbd429bcbb4b45a9f5e5b028fea5c97e76c80265161b0a91ec0
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/speller.py b/speller.py
@@ -16,6 +16,7 @@ def main():
def tokenize_sequence(sequence):
+ """Return a list each of all single and double character tokens."""
t = namedtuple('Tokens', (['single', 'pair']))
single = [sequence[i:i+1] for i in range(0, len(sequence))]
@@ -26,6 +27,9 @@ def tokenize_sequence(sequence):
def find_matches(sequence, symbols):
+ """Return a list of all element symbols matching
+ an item in the given sequence.
+ """
matches = []
indices = []
lower_symbols = [i.lower() for i in symbols]
@@ -34,10 +38,12 @@ def find_matches(sequence, symbols):
for i in lower_sequence:
matches += (x for x in lower_symbols if x == i)
indices += (lower_symbols.index(x) for x in lower_symbols if x == i)
+
return matches
def get_csv_data(file_name, column):
+ """Return in a list all data from a given column of a .csv file"""
data = []
with open(file_name) as infile: