Skip to content

Check competitors endpoint

Endpoint for checking competitors name in the text

Parameters:

Name Type Description Default
request ValidateSentencesResponse
required

Returns:

Name Type Description
response ValidateSentencesResponse
Source code in app/routers.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@router.post('/check_competitors', response_model=schemas.ValidateCheckCompetitorsResponse,
             response_model_exclude_none=True)
async def check_competitors(request: schemas.ValidateSentencesRequest) -> schemas.ValidateCheckCompetitorsResponse:
    """
    Endpoint for checking competitors name in the text

    Parameters
    ----------
    request : schemas.ValidateSentencesResponse


    Returns
    -------
    response : schemas.ValidateSentencesResponse
    """

    home_id, text, urduc = request.home_id, request.text, request.urduc

    is_all_valid, banned_words = services.check_competitors(text=text, urduc=urduc)

    return schemas.ValidateCheckCompetitorsResponse(home_id=home_id,
                                                    is_all_valid=is_all_valid,
                                                    banned_words=banned_words
                                                    )