TextSplitter
Split each selected Text item into several items.
Each piece becomes its own item, right after the previous piece and on the same page, with the kind and attributes of the item it came from. Pieces of a table become paragraphs. Empty pieces are dropped.
Parameters
- split_by : string, default=
Sentences - Where to cut each item. Sentences end at '.', '!', '?' or a blank line; paragraphs are separated by blank lines.
Methods
split(self, value: str) -> List[str]
TextSplitterCut one text into its non empty pieces.
Parameters
- value : str
- The text to cut.
Returns
- List[str]
- The pieces without surrounding whitespace, in order.
transform(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'DashAIDataset'
TextSplitterReturn the pieces of every selected item.
Parameters
- x : DashAIDataset
- The selected Text items, in one column.
- y : DashAIDataset, optional
- Ignored.
Returns
- DashAIDataset
- One row per piece, with the index of the item it came from.
build_report(self, data: 'Dict[str, Any]') -> 'Dict[str, Any]'
BaseConverterWrap converter-specific data with the producer converter name.
fit(self, x: 'DashAIDataset', y: Optional[ForwardRef('DashAIDataset')] = None) -> 'DocumentConverter'
DocumentConverterReturn the converter unchanged; override to learn from the items.
Parameters
- x : DashAIDataset
- The selected items.
- y : DashAIDataset, optional
- Ignored.
Returns
- DocumentConverter
- This converter.
get_credential(self, name: str)
ConfigObjectResolve a registered credential component by name.
Parameters
- name : str
- Credential component class name (e.g. "HuggingFaceCredential").
Returns
- BaseCredential
- An instance of the requested credential component.
get_metadata(cls) -> 'Dict[str, Any]'
BaseConverterGet metadata for the converter, used by the DashAI frontend.
Parameters
- cls : type
- The converter class (injected automatically by Python for classmethods).
Returns
- Dict[str, Any]
- Dictionary containing display name, short description, image preview path, category, icon, color, and whether the converter is supervised.
get_output_type(self, column_name: Optional[str] = None) -> DashAI.back.types.dashai_data_type.DashAIDataType
DocumentConverterReturn Text, the content type most document converters produce.
Parameters
- column_name : str, optional
- Unused.
Returns
- DashAIDataType
- A string backed
Texttype.
get_report(self) -> 'Union[Dict[str, Any], None]'
BaseConverterReturn the converter report produced after execution, if any.
Returns
- Dict[str, Any] or None
- JSON-serializable report dict, or
Nonewhen the converter does not produce one.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
infer_output_columns(self, inputs: 'List[StateItem]') -> 'StructureDelta'
BaseConverterEstimate what this converter does to its scope, without any data.
Parameters
- inputs : list of ColumnItem | BlockItem
- The dataset state items in this converter's scope.
Returns
- StructureDelta
- The scope items that survive (maybe retyped) and the new items.
items_result(contents: List[Any], sources: List[int], content_type: type = <class 'DashAI.back.types.value_types.Text'>, kinds: Optional[List[Optional[str]]] = None, attrs: Optional[List[Optional[Dict[str, Any]]]] = None) -> 'DashAIDataset'
DocumentConverterBuild the dataset a document converter returns.
Parameters
- contents : List[Any]
- The new item contents: strings for Text,
{"bytes", "path"}dicts for images. - sources : List[int]
- For each new item, the index of the input row it comes from.
- content_type : type, optional
Text(default) orDashAIImage.- kinds : List[Optional[str]], optional
- The element kind of each new item; None inherits or defaults.
- attrs : List[Optional[Dict[str, Any]]], optional
- The element attributes of each new item.
Returns
- DashAIDataset
contentandsourcecolumns, pluskindandattrswhen given.
rows_to_keep(self, x: "'DashAIDataset'") -> 'List[int]'
BaseConverterPositions of the rows of x that survive this converter.
Parameters
- x : DashAIDataset
- The converter's scope columns of one split.
Returns
- list of int
- 0-based positions of the kept rows, in order.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.
Parameters
- raw_data : dict
- A dictionary with the data provided by the user to initialize the model.
Returns
- dict
- A validated dictionary with the necessary objects.