Esempio n. 1
0
            "class": "main the-content"
        }
    },
]

for article in articles[0:1]:
    ###
    # Text processing
    ###
    # Create instance of TextProcess class that fetches text from url and filters it
    tp = TextProcess(url=article["url"],
                     filename=article["name"],
                     content_selector_dict=article["content-selector"])

    # Get filtered senteces in list
    filtered_sentences = tp.get_filtered_sentences()

    ###
    # Dictionary extraction
    ###
    # Create instance of Dictionary class comparses filtered sentences with those in
    # dictionary and creates node and edge list
    wt = Dictionary(dictionary_path=article["dictionary_path"])

    # Sets node nad edge list. First parameter is fitlered sentences, second is array
    # of wanted word types. Words that are not connected to other are set as node list
    # those that are connected are stored as edge list
    wt.set_words_as_node_and_egde_list(filtered_sentences, [Dictionary.NOUN])
    # Creates dictionary array that sets weight to amount of occurences of each pair
    wt.set_edge_list_as_weighted_edges()