TpT has many users from US, Canada, Australia and New Zealand. Users from these countries may be more likely to buy resources localized (localised?) to their own version of English. In order to provide them this, we need to be able to identify the version of English used in resources based on their title and description.
We have identified lists of words that identify British english or American english. And we have a list of product IDs that we want to identify as British or American.
In the language of your choice, write a command line program that:
- Downloads the latest versions of the British and American word lists from a gist
- Read the list of product IDs to test from a file on disk
- Fetches title and description of each product
- Checks each title and description for British or American words
- Flags each product as:
- American English
- British English
- Unknown
- Mixed British and American English
- Outputs the list of product IDs mapped to: british, american, unknown or mixed
- a british word list
- an american word list
- a product id list
To fetch data from the GraphQL API:
- submit a POST request to the following URL:
https://www.teacherspayteachers.com/graph/graphql
- submit the parameters as a JSON object with two fields:
query
andvariables
Use the following as the GraphQL query text to fetch product title and description:
query productText($productIds: [ID]!) {
products(ids: $productIds) {
id
name
description
}
}
This query expects a single variable as input (in the variables
field),
which should be structured as:
{"productIds": [1, 2, 3, 4, ...]}
- Does it work?
- Is the code readable?
- Is the program well tested?
- This is meant to be about the mechanics of the system. You don't need to deep in the NLP parts of the problem. Simple text processing is fine.