Skip to main content

A dictionary-based tokenizer.

Project description

DicTok

A dictionary-based tokenizer. It tokenizes a text based on known tokens defined in a given file.

Installation

pip install dictok

Usage

  1. Create your dic-file with a list of tokens e.g. tokens.dic:
super
man
note
book
store
...
  1. Import dictok and pass it the dictionary file as main parameter:
>>> import dictok
>>> dt = dictok.DicTok('tokens.dic')
  1. You are ready to use it:
>>> sent = "Superman bought a notebook in the bookstore."
>>> dt.tokenize(sent)
['Super', 'man', 'bought', 'a', 'note', 'book', 'in', 'the', 'book', 'store', '.']

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

dictok-0.0.2.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

dictok-0.0.2-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

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