scripts/old_scripts/clean_database.py
def clean_database():
    """
    Get rid of letters and nonbase forms of words
    """

    dictionary = create_database.get_dictionary()

    with open('data/cleaned_dictionary.txt', 'r+') as saved:
        for line in saved:
            word, frequency, position = line.split()
            frequency, position = map(int, [frequency, position])

        for cnt, (word, frequency) in enumerate(dictionary.items(), 1):
            if cnt <= position:
                continue

            if len(word) == 1:
                continue
            try:
                word = online_dictionary_scrapper.get_base_form(word)
            except Exception as e:
                print(e)
            else:
                saved.write(f"{word} {frequency} {cnt}\n")
                saved.flush()
                print(word, cnt)

    Get rid of letters and nonbase forms of words
    
Get rid of letters and nonbase forms of words
Get rid of letters and nonbase forms of words
def clean_database():
    dictionary = create_database.get_dictionary()
    with open('data/cleaned_dictionary.txt', 'r+') as saved:
        for line in saved:
            word, frequency, position = line.split()
            frequency, position = map(int, [frequency, position])
        for cnt, (word, frequency) in enumerate(dictionary.items(), 1):
            if cnt <= position:
                continue
            if len(word) == 1:
                continue
            try:
                word = online_dictionary_scrapper.get_base_form(word)
            except Exception as e:
                print(e)
            else:
                saved.write(f"{word} {frequency} {cnt}\n")
                saved.flush()
                print(word, cnt)
def clean_database ( ) : dictionary = create_database . get_dictionary ( ) with open ( 'data/cleaned_dictionary.txt' , 'r+' ) as saved : for line in saved : word , frequency , position = line . split ( ) frequency , position = map ( int , [ frequency , position ] ) for cnt , ( word , frequency ) in enumerate ( dictionary . items ( ) , 1 ) : if cnt <= position : continue if len ( word ) == 1 : continue try : word = online_dictionary_scrapper . get_base_form ( word ) except Exception as e : print ( e ) else : saved . write ( f"{word} {frequency} {cnt}\n" ) saved . flush ( ) print ( word , cnt )
Get rid of letters and nonbase forms of words
Get rid of letters and nonbase forms of words
"""
    Get rid of letters and nonbase forms of words
    """