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.4.tar.gz (456.9 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.4-py3-none-any.whl (455.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for poslog-0.4.tar.gz
Algorithm Hash digest
SHA256 e30333ead98a08785c06a10be7863524a4e78d7e2b95aa0bd99e1b6c570e5e9d
MD5 9d001b84f7a5444ba22e9e890260ef28
BLAKE2b-256 23522be7848e2a4119fb49627ad3913f6715882ed5a91f7a8427d0247e2a4b09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: poslog-0.4-py3-none-any.whl
  • Upload date:
  • Size: 455.3 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 60d84337105f04215cd988dfdfaf2e0890eae6f0a5e9a81357f53bbf877f1a88
MD5 4800094079f4284a640f3c6f23174d18
BLAKE2b-256 06cad70cb8535f00173e5940ce1525a30d32eea18734f0c22ea9c2cb46887730

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