To add keywords from a file in the form key-value map.
The idea was to read a list from the file in the form of key and value (in the form of list).
Args:
keyword_file : path to keywords file
sep : unique separator for each line of the the keyword_file
encoding : specify the encoding of the file
Examples:
keywords file format can be like:
Each line contains a new key value pair and has a single separator .
Separator should be unique in lines.
Value is in form of a list.
Quotation marks only required for values in the value list.
>>> # Option 1: config.txt content
>>> # key inv single = ['invoice']
>>> # key_inv_number = ['invoice number', 'invoice no', 'invoice #', 'invoice#']
>>> # key inv_date = ['invoice date', 'invoice dt', 'issue date', 'date of invoice', 'date of issue', 'issue dt', 'dt of issue']
>>> keyword_processor.add_keywords_from_file_dict('config.txt' ,sep='=')
Raises:
IOError: If `keyword_file` path is not valid.
AttributeError: No separator provided in the line. Value of key should be a list.
AttributeError: Multiple separators present or choose a unique for the lines
To add keywords from a file in the form key-value map. The idea was to read a list from the file in the form of key and value (in the form of list).