allenai / allennlp-semparse

A framework for building semantic parsers (including neural module networks) with AllenNLP, built by the authors of AllenNLP
Apache License 2.0
107 stars 24 forks source link

Update to support Allen NLP 1.0 #25

Closed tedgoddard closed 4 years ago

tedgoddard commented 4 years ago

This branch turned out to be the main functional changes from https://github.com/allenai/allennlp-semparse/pull/23

With these changes it is possible to run a wikitables prediction using AllenNLP 1.0.

tedgoddard commented 4 years ago

Tests were not modified since I am not familiar with them. Instead, the following simple script was used:

from allennlp.data.tokenizers import SpacyTokenizer
from allennlp.predictors import Predictor
import allennlp_models.rc
from allennlp_semparse import predictors, models
from allennlp_semparse.dataset_readers import wikitables

archive_url = "https://storage.googleapis.com/allennlp-public-models/wikitables-model-2020.02.10.tar.gz"
wikitables = Predictor.from_path(archive_url, "wikitables-parser")

data = { "question": "who has three apples?", "table": "Name\tApples\tOranges\nBill\tTwo\tFour\nTed\tThree\tFive" }
print(wikitables.predict_json(data))
matt-gardner commented 4 years ago

Thanks, this is super helpful! I'll take it from here, hopefully within the next day or two.

matt-gardner commented 4 years ago

Thanks for getting this started @tedgoddard, it's now good to go.