Skip to content

Added add_keywords_from_file_dict function#124

Open
rudrashisgorai wants to merge 47 commits into
vi3k6i5:masterfrom
rudrashisgorai:master
Open

Added add_keywords_from_file_dict function#124
rudrashisgorai wants to merge 47 commits into
vi3k6i5:masterfrom
rudrashisgorai:master

Conversation

@rudrashisgorai
Copy link
Copy Markdown

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

vi3k6i5 and others added 30 commits November 10, 2017 20:47
added reference to flashtext paper
  `charactes` | `characters`
  `explaination` | `explanation`
  `matche` | `match`
Fix issue with incomplete keyword at the end of the sentence
Performances improvement for strings manipulations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants