Grew-count web service
The Grew-count web service is available on https://count.grew.fr.
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. Corpora available are ones which are used in Grew-match.
Note that if you want to run similar requests on your own data, you should consider using the grewpy library: see an example here.
The count service
The URL of the main service is https://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.19",
"SUD_English-PUD@2.19"
]
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.
The set_config service
If you want to run requests on UD or SUD data, you should first run the service. For instance from Python:
# Set the config to "UD"
url = "https://count.grew.fr/count"
requests.request("POST", f'{url}/set_config', data={'config': 'ud'})
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.19.
import requests
url = "https://count.grew.fr/count"
data={
'corpora': '''[
"SUD_Arabic-PUD@2.19",
"SUD_Chinese-PUD@2.19",
"SUD_Czech-PUD@2.19",
"SUD_English-PUD@2.19",
"SUD_Finnish-PUD@2.19",
"SUD_French-PUD@2.19",
"SUD_German-PUD@2.19",
"SUD_Hindi-PUD@2.19",
"SUD_Icelandic-PUD@2.19",
"SUD_Indonesian-PUD@2.19",
"SUD_Italian-PUD@2.19",
"SUD_Japanese-PUD@2.19",
"SUD_Korean-PUD@2.19",
"SUD_Polish-PUD@2.19",
"SUD_Portuguese-PUD@2.19",
"SUD_Russian-PUD@2.19",
"SUD_Spanish-PUD@2.19",
"SUD_Swedish-PUD@2.19",
"SUD_Thai-PUD@2.19",
"SUD_Turkish-PUD@2.19"
]
''',
'requests': '''{
"sv": "pattern { V -[subj]-> S; S << V }",
"vs": "pattern { V -[subj]-> S; V << S }"
}
'''}
# Set the config to "SUD"
requests.request("POST", f'{url}/set_config', data={'config': 'sud'})
response = requests.request("POST", url, data=data)
print(response.text, end="") # The `response.text` already contains a newline
The script should produce, the following TSV file:
ERROR: Cannot find corpus `SUD_Arabic-PUD@2.19`




