Ejemplo n.º 1
0
def how_word_in_file_no_replay(file_name,
                               path_of_file="./",
                               encoding_file="utf-8"):
    if (seach_file(file_name, path_of_file) != None):

        with open(file_name, mode="r", encoding=encoding_file) as file:
            words = 0
            no_replay_words = []
            for string in file:

                string = str(str(string).upper())

                for letter in string:
                    if (letter.isalpha() == False and letter != ' '):
                        string = string.replace(letter, '')

                string = list(filter(None, str(string).split(' ')))
                words += len(string)
                for word in string:

                    unical = True
                    if (len(no_replay_words) == 0):
                        no_replay_words.append(word)
                    else:
                        for reply in no_replay_words:
                            if word == reply or word == '':
                                unical = False
                                words -= 1
                                break
                        if (unical):
                            no_replay_words.append(word)
            return words
    return 0
Ejemplo n.º 2
0
def symbols_in_text(file_name, path_of_file="./", encoding_file="utf-8"):
    if (seach_file(file_name, path_of_file) != None):

        with open(file_name, mode="r", encoding=encoding_file) as file:
            symbols = 0
            for string in file:
                symbols += len(str(string))

            return symbols
    return 0
Ejemplo n.º 3
0
def how_word_in_file(file_name, path_of_file="./", encoding_file="utf-8"):
    if (seach_file(file_name, path_of_file) != None):

        with open(file_name, mode="r", encoding=encoding_file) as file:
            words = 0
            for string in file:
                for letter in string:
                    if (letter.isalpha() == False and letter != ' '):
                        string = string.replace(letter, '')
                words += len(list(filter(None, str(string).split(' '))))
            return words
    return 0
Ejemplo n.º 4
0
def how_sentences_in_file_three_dots(file_name,
                                     path_of_file="./",
                                     encoding_file="utf-8"):
    if (seach_file(file_name, path_of_file) != None):

        with open(file_name, mode="r", encoding=encoding_file) as file:

            sentense = 0
            for string in file:
                string = str(str(string).upper())
                sentense += len(list(find_all(str(string), '...')))
            return sentense
    return 0