예제 #1
0
async def questions(
    request_data: ListData, current_user: User = Depends(auth.get_current_user)
):
    """
    Generates other similar text by augmenting original text
    """
    plain_text_data = [
        Utility.extract_text_and_entities(data)[0] for data in request_data.data
    ]
    response = requests.post(
        Utility.environment["augmentation"]["paraphrase_url"], json=plain_text_data
    )
    return response.json()
예제 #2
0
 def test_prepare_nlu_text(self):
     expected = "India is beautiful"
     text, entities = Utility.extract_text_and_entities(expected)
     actual = Utility.prepare_nlu_text(text, entities)
     assert expected == actual
예제 #3
0
 def test_prepare_nlu_text_with_entities(self):
     expected = "n=[8](n), p=1[8](n), k=2[8](n) ec=[14](ec), ph=[3](p)"
     text, entities = Utility.extract_text_and_entities(expected)
     actual = Utility.prepare_nlu_text(text, entities)
     assert expected == actual