INNER CODE UNIT · Python

_join_text_components

dragondrop-cloud/cloud-concierge · nlpengine/main.py:150

def _join_text_components(example_text_list: List[str], end_index: int) -> str:
    """
    Joins the text components within example_text_list into a single string.
    """
    return ". ".join(example_text_list[:end_index]).replace("  ", " ") + "."


def _doc_to_example_text_list(doc: str) -> List[str]:
    """
    Converts a document into a series of individual pieces of text, separated by sentence.
    """
    return [text for text in doc.split(".") if text != " "]


def _split_into_train_and_evaluation_data(training_data_examples: List) -> dict:
    """
    Splits the training and evaluation data out of training_data_examples with an 80/20 train/eval split.
    """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…