Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Conversation

@rsogit
Copy link
Contributor

@rsogit rsogit commented Jan 5, 2021

Nesse PR eu adicionei uma função para exportar as frases de teste e corrigi algumas coisas relacionadas ao cadastro de entidades na função de criar frases de teste.

rsogit added 2 commits January 5, 2021 11:25
… with entities; Adjusting a language issue in create_example;
@rsogit rsogit requested a review from PeterAlexandre January 5, 2021 14:55
Copy link
Contributor

@PeterAlexandre PeterAlexandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sobe essa alteração que comentei, que fica completo!

O PR estava bom e ainda bem que você continua usando o código! Valeu!

with open(f'{filename}.json', 'w') as outfile:
json.dump(examples, outfile)

def export_evaluate_to_json(filename, *args):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eae, @rsogit! Tava pensando aqui, e vi que essa função é igual a da linha 39 export_to_json, mudando apenas o final do endpoint ("examples/" ou "evaluate/").

Será que ficaria melhor permanecer com uma só função, e adicionar um parâmetro para receber o fim do endpoint examples ou evaluate?

Tava pensando em algo mais ou menos assim:

def export_to_json(filename, endpoint='examples', *args):
    ...
    results = get_all_examples(
        ...
        # alterando o final da string com a variável endpoint
        next_call=f'{base_url}/repository/{endpoint}/'

Para funcionar, chamaríamos no terminal

python main.py nome_arquivo evaluate

Edit 1

Ou algo assim, que considero com menos chances de erro:

def export_to_json(filename, evaluate=False, *args):
    # Getting all sentences from bothub repository
    endpoint = 'examples'
    if evaluate:
        endpoint = 'evaluate'

    results = get_all_examples(
        ...
        # alterando o final da string com a variável endpoint
        next_call=f'{base_url}/repository/{endpoint}/'

Para funcionar, chamaríamos no terminal

python main.py export_to_json nome_arquivo evaluate=True

O que acha? Se puder, aproveita que tá com o código por ai, e aplica essa melhoria, se achar necessário.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants