Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to use Custom Classifier #203

Open
yatin-rxlogix opened this issue Dec 20, 2019 · 1 comment
Open

Not able to use Custom Classifier #203

yatin-rxlogix opened this issue Dec 20, 2019 · 1 comment

Comments

@yatin-rxlogix
Copy link

I have used following statement to train a Classifier on my Custom Data Set but I am not able to use this Custom Classifier for Signature Extraction. Can somebody help in this issue as where am I doing wrong.

  • c.train(c.init(), "train.data", "classifier")
  • signature.classifier = c
  • text, signature_value = signature.extract(message, sender='@message.com')
@Rokfordchez
Copy link

When you create you own dataset in "/path/to/your/P/folder"
Execution of:

build_extraction_dataset(os.path.join(settings.BASE_DIR, 'data', 'P'),
                         os.path.join(get_python_lib(), 'talon/signature/data/train.data'))

build_extraction_dataset change file 'talon/signature/data/train.data' with you "/path/to/your/P/folder" data

Then you train classifier with new 'talon/signature/data/train.data':

c.train(c.init(), os.path.join(get_python_lib(), 'talon/signature/data/train.data'),
        os.path.join(get_python_lib(), 'talon/signature/data/classifier'))

execution of this code change 'talon/signature/data/classifier'

When you call talon.init()
it execute:

def init():
    register_xpath_extensions()
    if ML_ENABLED:
        signature.initialize()

signature.initialize() call:

EXTRACTOR_FILENAME = os.path.join(DATA_DIR, 'classifier')
EXTRACTOR_DATA = os.path.join(DATA_DIR, 'train.data')


def initialize():
    extraction.EXTRACTOR = classifier.load(EXTRACTOR_FILENAME,
                                           EXTRACTOR_DATA)

in extraction.py in _mark_lines call EXTRACTOR as classifier in is_signature_line

So, after train classifier EXTRACTOR_DATA and EXTRACTOR_FILENAME already have get you email raw data with #sig#. And after call talon.init() you use your training classifier

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

No branches or pull requests

2 participants