compass.plugin.ordinance.KeywordBasedHeuristic#

class KeywordBasedHeuristic[source]#

Bases: BaseHeuristic, ABC

Perform a heuristic check for mention of a technology in text

Methods

check(text[, match_count_threshold])

Check for mention of a tech in text

Attributes

GOOD_TECH_ACRONYMS

Tech acronyms

GOOD_TECH_KEYWORDS

Tech keywords

GOOD_TECH_PHRASES

Tech phrases

MIN_DEFAULT_MATCHES

Default number of keyword matches to pass heuristic check

NOT_TECH_WORDS

Not tech keywords

MIN_DEFAULT_MATCHES = 2#

Default number of keyword matches to pass heuristic check

Type:

int

check(text, match_count_threshold=None)[source]#

Check for mention of a tech in text

This check first strips the text of any tech “look-alike” words (e.g. “window”, “windshield”, etc for “wind” technology). Then, it checks for particular keywords, acronyms, and phrases that pertain to the tech in the text. If enough keywords are mentions (as dictated by match_count_threshold), this check returns True.

Parameters:
Returns:

boolTrue if the number of keywords/acronyms/phrases detected meets or exceeds the match_count_threshold.

abstract property NOT_TECH_WORDS#

Not tech keywords

Type:

Iterable

abstract property GOOD_TECH_KEYWORDS#

Tech keywords

Type:

Iterable

abstract property GOOD_TECH_ACRONYMS#

Tech acronyms

Type:

Iterable

abstract property GOOD_TECH_PHRASES#

Tech phrases

Type:

Iterable