Keyword detection¶
Introduction¶
The keyword (markers) module allows you to specify words and phrases to detect. For example, you may detect the presence of reasoning using the following list of markers: [‘because’, ‘in my opinion’, ‘however’].
Usage¶
To use the module:
>>> import coast_core
>>> coast_core.markers.function(to_use)
or:
>>> from coast_core import markers
>>> markers.function(to_use)
Functions¶
A collection of functions that can be used for analysing the markers within result text.
-
coast_core.markers.
analyse_set_of_markers_for_a_given_article
(article_text, list_of_markers)¶ Given a link and a set of markers, return a frequency dictionary that shows how many times each marker appeared in the extracted article.
Parameters: - article_text – The text to search.
- list_of_markers – A list of markers to search for. Each marker is an ngram.
Returns: A dictionary of markers and their frequency counts for a given link.
-
coast_core.markers.
run_all_markers
(article_text, config_file)¶ Runs a complete end-to-end analysis of markers using all other functions.
Parameters: - article_text – The text to search.
- config_file – A JSON file containing all relevant information for conducting the analysis. The config file should be structured as shown in the test data: https://github.com/zedrem/coast_core/blob/master/coast_core/resources/example/config_file.json. Each specific marker file should then be structured as shown in: https://github.com/zedrem/coast_core/blob/master/coast_core/resources/example/markers_experience_9.json.
Returns: An object containing all markers found