Grew-count web service
The Grew-count web service is available on http://count.grew.fr. It is still in development and it may evolve in the near future.
With the Grew-count web service, it is possible to send a list of Grew requests and a list of corpora and to get a TSV file with the number of occurrences of each request in each corpus.
The count
service
The URL of the main service is http://count.grew.fr/count and it must be called with two POST parameters: corpora
and requests
.
The corpora
parameter must be a JSON string describing a list of corpora. For instance:
[
"SUD_French-PUD@2.13",
"SUD_English-PUD@2.13"
]
The available corpora are the same as the ones available on Grew-match, with the same identifiers.
The requests
parameter must be a JSON string describing a dictionary of requests. For instance:
{
"sv": "pattern { V -[subj]-> S; S << V }",
"vs": "pattern { V -[subj]-> S; V << S }"
}
Again, the requests are the same as the ones available on Grew-match. requests syntax can be learned through Grew-match’s tutorial and some documentation is available on the request page.
Example of usage with Python
The web service can be called with Python’s requests
library.
The code below (Download) shows a way to call the web service with the two requests above and with the 20 PUD corpora of SUD 2.13.
import requests
url = "http://count.grew.fr/count"
data={
'corpora': '''[
"SUD_Arabic-PUD@2.13",
"SUD_Chinese-PUD@2.13",
"SUD_Czech-PUD@2.13",
"SUD_English-PUD@2.13",
"SUD_Finnish-PUD@2.13",
"SUD_French-PUD@2.13",
"SUD_German-PUD@2.13",
"SUD_Hindi-PUD@2.13",
"SUD_Icelandic-PUD@2.13",
"SUD_Indonesian-PUD@2.13",
"SUD_Italian-PUD@2.13",
"SUD_Japanese-PUD@2.13",
"SUD_Korean-PUD@2.13",
"SUD_Polish-PUD@2.13",
"SUD_Portuguese-PUD@2.13",
"SUD_Russian-PUD@2.13",
"SUD_Spanish-PUD@2.13",
"SUD_Swedish-PUD@2.13",
"SUD_Thai-PUD@2.13",
"SUD_Turkish-PUD@2.13"
]
''',
'requests': '''{
"sv": "pattern { V -[subj]-> S; S << V }",
"vs": "pattern { V -[subj]-> S; V << S }"
}
'''}
response = requests.request("POST", url, data=data)
print(response.text)
The script should produce, the following TSV file:
Corpus # sentences sv vs
SUD_Arabic-PUD@2.13 1000 486 941
SUD_Chinese-PUD@2.13 1000 1833 11
SUD_Czech-PUD@2.13 1000 926 376
SUD_English-PUD@2.13 1000 1343 77
SUD_Finnish-PUD@2.13 1000 1013 93
SUD_French-PUD@2.13 1000 1352 64
SUD_German-PUD@2.13 1000 1124 386
SUD_Hindi-PUD@2.13 1000 1132 5
SUD_Icelandic-PUD@2.13 1000 1404 434
SUD_Indonesian-PUD@2.13 1000 1424 129
SUD_Italian-PUD@2.13 1000 1024 136
SUD_Japanese-PUD@2.13 1000 1525 0
SUD_Korean-PUD@2.13 1000 1564 1
SUD_Polish-PUD@2.13 1000 856 212
SUD_Portuguese-PUD@2.13 1000 1210 104
SUD_Russian-PUD@2.13 1000 1155 254
SUD_Spanish-PUD@2.13 1000 1075 156
SUD_Swedish-PUD@2.13 1000 1161 384
SUD_Thai-PUD@2.13 1000 1658 10
SUD_Turkish-PUD@2.13 1000 1325 6