Beispiel #1
0
def sortkey(word):
    return (frequency.get_frequency(word), word)
Beispiel #2
0
def sortkey(word):
    return (frequency.get_frequency(word), word)
Beispiel #3
0
# Macros which appear somewhere but are not in the symbols index, macros.tex,
# or configuration files.
macros -= antimacros

# Uncomment to see the macros.
#for macro in sorted(macros - antimacros):
#    print (macro)


def sortkey(word):
    return (frequency.get_frequency(word), word)


def filter_word(w, fs):
    for r in fs:
        if re.search(r, w, flags=re.IGNORECASE): return True
    return False


for key in sorted(words.keys(), key=sortkey):
    if filter_word(key, filter_re):
        freq = frequency.get_frequency(key)
        if freq > 1100000:
            continue
        print("\n\n======== %s [%d]\n\n" % (key, freq))
        for (excerpt, fn, pos) in words[key][:max_occurrences]:
            print("   ...%s... [%s @ %d]" % (excerpt, fn, pos))
        if len(words[key]) > max_occurrences:
            print("\n   [[%d omitted occurrences]]" %
                  (len(words[key]) - max_occurrences))
Beispiel #4
0
        else:
            words[key] = [(excerpt, fn, pos)]

# Macros which appear somewhere but are not in the symbols index, macros.tex,
# or configuration files.
macros -= antimacros

# Uncomment to see the macros.
#for macro in sorted(macros - antimacros):
#    print (macro)

def sortkey(word):
    return (frequency.get_frequency(word), word)

def filter_word(w, fs):
    for r in fs:
        if re.search(r, w, flags = re.IGNORECASE): return True
    return False

for key in sorted(words.keys(), key = sortkey):
    if filter_word(key, filter_re):
        freq = frequency.get_frequency(key)
        if freq > 1100000:
            continue
        print("\n\n======== %s [%d]\n\n" % (key, freq))
        for (excerpt, fn, pos) in words[key][:max_occurrences]:
            print ("   ...%s... [%s @ %d]" % (excerpt, fn, pos))
        if len(words[key]) > max_occurrences:
            print ("\n   [[%d omitted occurrences]]" % (len(words[key]) - max_occurrences))