- class composes.semantic_space.peripheral_space.PeripheralSpace(core_space, matrix_, id2row, row2id=None)¶
classdocs
- classmethod build(core_space, **kwargs)¶
Reads in data files and extracts the data to construct a semantic space.
If the data is read in dense format and no columns are provided, the column indexing structures are set to empty.
- Args:
data: file containing the counts format: format on the input data file: one of sm/dm rows: file containing the row elements. Optional, if not provided,
extracted from the data file.cols: file containing the column elements
- Returns:
- A semantic space build from the input data files.
- Raises:
- ValueError: if one of data/format arguments is missing.
- if cols is missing and format is “sm” if the input columns provided are not consistent with the shape of the matrix (for “dm” format)
- add_rows(matrix_, id2row)¶
Adds rows to a peripheral space.
- Args:
- matrix_: Matrix type, the matrix of the elements to be added. id2row: list, string identifiers of the rows to be added.
Modifies the current space by appending the new rows. All operations of the core space are projected to the new rows.
- Raises:
- ValueError: if attempting to add row strings which are already
- in the space. matrix of the new data is not consistent in shape with the current data matrix.