Skip to main content

PosLog: A CRF-based Part-of-Speech Tagger for Log Messages

Project description

PosLog

A CRF-based Part-of-Speech (POS) Tagger for Log Messages.

Usage

  • Use default model

    from nlp import PrometeusTokenizer
    from nlp.pos import PosLogCRF
    
    tokenizer=PrometeusTokenizer()
    s="Tag this sentence."
    tokens=tokenizer.tokenize(s)
    # ['Tag', 'this', 'sentence', '.']
    
    pos_log=PosLogCRF()
    pos_log.predict(tokens)
    # ['VERB' 'DET' 'NOUN' 'PUNCT']
    
  • Train your own model
    Define model name in constructor:

    pos_log=PosLogCRF(model_name="my_model")
    

    PosLog takes training data as tokens and tags separately:

    train(X_train_tokens:list[list[str]], y_train_tags:list[list[str]])
    

    Or as token and tag pairs:

    train_from_tagged_sents(tagged_sents:list[list[tuple[str,str]]])
    

    Note training will override existing model with the same name.

  • Use your own model
    Just call the constructor with the model name:

    pos_log=PosLogCRF(model_name="my_model")
    

Dependencies

PosLog relies on nltk corpora: words, stopwords, wordnet.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poslog-0.2.tar.gz (456.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poslog-0.2-py3-none-any.whl (454.5 kB view details)

Uploaded Python 3

File details

Details for the file poslog-0.2.tar.gz.

File metadata

  • Download URL: poslog-0.2.tar.gz
  • Upload date:
  • Size: 456.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for poslog-0.2.tar.gz
Algorithm Hash digest
SHA256 313b1e0aeff69dd6934841495a9df58fe29f3ebdcb2df55e5278ff323c23525a
MD5 28198a6c1f7f66c87b4718279e5a61d3
BLAKE2b-256 95511fc0ac32aa440232dd655d76c3f42269f2f5348a011c1d8a22cd51b05945

See more details on using hashes here.

File details

Details for the file poslog-0.2-py3-none-any.whl.

File metadata

  • Download URL: poslog-0.2-py3-none-any.whl
  • Upload date:
  • Size: 454.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for poslog-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ceeef1e07808571a0d8c8629076aed8482895fe5909336f453931bfb1306bd08
MD5 a7f7ed147010d6fc98e0beaab71936b9
BLAKE2b-256 e37e556b72e94e87962ca52592f4e5ecb0bebc84c0864e73125b91c6ea713fb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page