rupo.files package

Submodules

rupo.files.reader module

class rupo.files.reader.FileType(value)[source]

Bases: Enum

Тип файла.

JSON = '.json'
RAW = '.txt'
VOCAB = '.voc'
XML = '.xml'
class rupo.files.reader.Reader[source]

Bases: object

Считывание из файлов.

static get_paths(path: str, ext: str) Iterator[str][source]

Получение всех файлов заданного типа по заданному пути.

Parameters
  • path – путь к файлу/папке.

  • ext – требуемое расширение.

static read_markups(path: str, source_type: FileType, is_processed: bool, stress_predictor: Optional[StressPredictor] = None) Iterator[Markup][source]

Считывание разметок (включая разметку по сырым текстам).

Parameters
  • path – путь к файлу/папке.

  • source_type – тип файлов.

  • is_processed – уже размеченные тексты?

  • stress_predictor – классификатор ударений (для неразмеченных текстов).

static read_texts(path: str, source_type: FileType) Iterator[str][source]

Считывание текстов.

Parameters
  • path – путь к файлу/папке.

  • source_type – тип файлов.

static read_vocabulary(path: str)[source]

Считывание словаря.

Parameters

path – путь к словарю.

Returns

слово и его индекс.

rupo.files.test_reader module

class rupo.files.test_reader.TestReader(methodName='runTest')[source]

Bases: TestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_read()[source]

rupo.files.test_writer module

class rupo.files.test_writer.TestWriter(methodName='runTest')[source]

Bases: TestCase

test_write()[source]

rupo.files.writer module

class rupo.files.writer.Writer(destination_type: FileType, path: str)[source]

Bases: object

Запись в файл.

close() None[source]

Закрываем файл.

open() None[source]

Открываем файл, вызывать до начала записи.

write_markup(markup: Markup) None[source]

Запись разметки в уже открытый файл. :param markup: разметка.

static write_markups(destination_type: FileType, markups: List[Markup], path: str) None[source]

Запись разметок в файл.

Parameters
  • destination_type – тип файла.

  • markups – разметки.

  • path – путь к файлу.

Module contents