deepr.vocab package

Submodules

deepr.vocab.base module

Utilities for vocabularies.

deepr.vocab.base.read(path)[source]

Read vocabulary from file.

Parameters:

path (str) – Path to .txt file with one item per line

Return type:

List[str]

deepr.vocab.base.size(path)[source]

Return vocabulary size from mapping file.

Parameters:

path (str) – Path to .txt file with one item per line

Return type:

int

deepr.vocab.base.write(path, vocab)[source]

Write vocabulary to file.

Parameters:
  • path (str) – Path to .txt file with one item per line

  • vocab (Iterable[str]) – Iterable of lexemes (strings) Lexemes should not have newline characters.

Module contents