Select Git revision
mnist_data_module.py
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
OED.java 7.53 KiB
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.json.JSONObject;
import org.json.JSONArray;
public class OED
/**
* to get the word_ID right, concatenate the word with the following codes
* - nn01 for Noun
* - vb01 for Verb
* - jj01 for Adjective
* - rb01 for Adverb
* - su01 for Suffix
* - pr01 for Prefix
* the running number orders the entries in the dictionary, i.e. the number of meanings
*/
{
private String word = "";
private String morpheme = "";
private String wordclass = "";
private String affixtype = "";
private int enddateCorpus = 0;
private int startdateCorpus = 0;
private final String app_id;
private final String app_key;
private IO restapi = new IO();
private String resultPath = "";
private Corpus corpus;
//for each look up the word and one of its contained affixes is needed
public OED(String word, String morpheme, String wordclass, String affixtype, Corpus corpus, String app_key, String app_id, String resultPath)
{
this.corpus = corpus;
this.app_id = app_id;//restapi.readFile("C:\\Users\\Peukert\\Documents\\Morphochron\\id", false);
this.app_key = app_key;//restapi.readFile("C:\\Users\\Peukert\\Documents\\Morphochron\\key", false);
this.word = word;
this.morpheme = morpheme;
this.wordclass = wordclass;
this.affixtype = affixtype;
this.startdateCorpus = corpus.getStartDate();
this.enddateCorpus = corpus.getEndDate();
this.resultPath = resultPath;
}
/*
* gets word representation of OED REST API as JSON object
*/
private String getRESTAPIWordRepresentation(String word)
{
return "https://oed-researcher-api.oxfordlanguages.com/oed/api/v0.2/words/?lemma=" + word;
}
/*
* gets the roots OED representation of a word
*/
private String getRESTAPIRootRepresentation(String wordID)
{
return "https://oed-researcher-api.oxfordlanguages.com/oed/api/v0.2/word/" + wordID + "/roots/";