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.3.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.3-py3-none-any.whl (454.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: poslog-0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 cd9f8d4d0a6079c35978410de936023b6cf69e2679978f543978ff39f7b67a87
MD5 8acdf2c29e3e96c1d59bea40ca4e6ab7
BLAKE2b-256 955cf179d48db101128cb1afe33b6dc675a1a8cd5f1699573d3241036ee17b83

See more details on using hashes here.

File details

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

File metadata

  • Download URL: poslog-0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ec45e09d595450e091b1c1861bddc359642771b2364064e11e4587e74151790f
MD5 2d73676c4cd1987564c236c4c0c49ca4
BLAKE2b-256 930e541c755830beb279c5274b75d10fbb942f754b87764ae97800fbfe2f37de

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