# recognize: processes two-levels-topic-recognition # Authors: Paul Libbrecht, Pierre Günthner and Alexander Gantikow from the AISOP project # Installation: Install spacy then... # Usage: python recognize.py l1-model l2-models "this is a text" # l1-model path: a relative path (starting from this script) pointing to the level-1 model folder # l2-model path: a relative path (starting from this script) pointing to the folder containing a folder for each L2-label # "this is a text": the text to recognize import sys # System-specific parameters and functions, part of Py import spacy # Natural language processing from pathlib import Path # Object-oriented filesystem paths, part of Py import json # JSON object dumping functions RoundTo = 2 # Round to precision of n decimals Encoding = 'utf8' # Encoding of the html file to be read and parsed via BeautifulSoup ScoreThreshold = 0.2 # Min. spacy probability value for an element to be analysed/enriched. MaxResults = 3 # Max. number of concepts/labels added to an html element ParagraphMinLetters = 10 # Min. number of letters of paragraph to be considered in analysis ListMinLetters = 10 # Min. number of letters of