dstk.lib_types package#

Submodules#

dstk.lib_types.conllu_types module#

dstk.lib_types.dstk_types module#

class dstk.lib_types.dstk_types.Bigram(collocate: Word, target_word: str)[source]#

Bases: NamedTuple

Represents a pair of words occurring together.

Parameters:
  • collocate (Word) – The collocate word.

  • target_word (str) – The target word in the bigram.

collocate: Word#

Alias for field number 0

target_word: str#

Alias for field number 1

dstk.lib_types.dstk_types.Collocates#

A tuple representing a group of collocates.

alias of tuple[Word, …]

class dstk.lib_types.dstk_types.Concordance(left_context: str, text: str, right_context: str)[source]#

Bases: NamedTuple

A record of a word’s occurrence within its surrounding context.

Parameters:
  • left_context (str) – The text appearing before the target word.

  • text (str) – The specific word or phrase being analyzed.

  • right_context (str) – The text appearing after the target word.

left_context: str#

Alias for field number 0

right_context: str#

Alias for field number 2

text: str#

Alias for field number 1

dstk.lib_types.dstk_types.ContextGenerator#

A generator yielding context pairs for iteration.

alias of Generator[tuple[list[Word], list[Word]], None, None]

dstk.lib_types.dstk_types.Contexts#

A pair of lists representing the left and right contexts of a target word.

alias of tuple[list[Word], list[Word]]

dstk.lib_types.dstk_types.DirectedCollocates#

Directed collocates represented as a tuple of a word and a pair of directional tags.

alias of tuple[Word, tuple[str, str]]

dstk.lib_types.dstk_types.DocumentIndex#

A dictionary mapping identifiers to Stanza Documents.

alias of dict[str, Document]

dstk.lib_types.dstk_types.LexicalItem: TypeAlias = stanza.models.common.doc.Token | stanza.models.common.doc.Word#

A single unit of analysis, either a Word or a Token.

dstk.lib_types.dstk_types.LexicalItemSequence#

A sequence of words or tokens for processing.

alias of Sequence[Word] | Sequence[Token]

dstk.lib_types.dstk_types.LinguisticSequences#

Collections of sentences or word/token sequences used in linguistic analysis.

alias of Sequence[Sentence] | Sequence[Sequence[Word]] | Sequence[Sequence[Token]]

dstk.lib_types.dstk_types.MethodDict#

A dictionary defining a method name and the keyword arguments passed to it.

alias of dict[str, dict[str, Any]]

class dstk.lib_types.dstk_types.Neighbor(word: str, score: float)[source]#

Bases: NamedTuple

A tuple representing a neighboring word and associated statistical score.

Parameters:
  • word (str) – The neighboring word found in the text.

  • score (float) – The statistical weight or confidence of the neighbor.

score: float#

Alias for field number 1

word: str#

Alias for field number 0

dstk.lib_types.dstk_types.Neighbors#

A list of neighbors with their respective scores.

alias of list[Neighbor]

dstk.lib_types.dstk_types.NeuralModels: TypeAlias = gensim.models.word2vec.Word2Vec | fasttext.FastText._FastText#

Supported neural language models (Word2Vec or FastText).

class dstk.lib_types.dstk_types.ParameterResult(name: str, result: Any)[source]#

Bases: NamedTuple

The result of an individual step within a workflow.

Parameters:
  • name (str) – The name of the step.

  • result (Any) – The output produced by the step.

name: str#

Alias for field number 0

result: Any#

Alias for field number 1

dstk.lib_types.dstk_types.ReturnAllGenerator#

Generator yielding ParameterResult objects containing both name and data.

alias of Generator[ParameterResult, None, None]

dstk.lib_types.dstk_types.ReturnParameterGenerator#

Generator yielding only the results of a parameter step without metadata.

alias of Generator[Any, None, None]

dstk.lib_types.dstk_types.Workflow#

A mapping of workflow stages to an ordered list of methods or a custom Hook.

alias of dict[str, list[dict[str, dict[str, Any]]] | Hook]

dstk.lib_types.fasttext_types module#

dstk.lib_types.gensim_types module#

dstk.lib_types.nltk_types module#

dstk.lib_types.numpy_types module#

dstk.lib_types.pandas_types module#

dstk.lib_types.plotly_types module#

dstk.lib_types.sklearn_types module#

dstk.lib_types.spacy_types module#

dstk.lib_types.stanza_types module#

Module contents#