Skip to content

Commit

Permalink
etymology almost working
Browse files Browse the repository at this point in the history
  • Loading branch information
lavedon committed Jun 6, 2021
1 parent c6ee3ab commit b8ae0b9
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 1 deletion.
27 changes: 27 additions & 0 deletions API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ public static void APICalls(CurrentQuery query)
tempDefinition.RecordedFirstUseSource = data[i].GetProperty("first_use").ToString();
tempDefinition.RecordedFirstUseYear = int.Parse(data[i].GetProperty("daterange").GetProperty("start").ToString());
var parts = data[i].GetProperty("parts_of_speech").EnumerateArray();

while (parts.MoveNext())
{
var part = parts.Current;
Expand All @@ -375,7 +376,33 @@ public static void APICalls(CurrentQuery query)
{
tempDefinition.IsWordMainDefinition = false;
}
JsonElement etymologyObject = data[i].GetProperty("etymology");
var etymons = etymologyObject.GetProperty("etymons").EnumerateArray();
while (etymons.MoveNext())
{
var etymon = etymons.Current;
tempDefinition.DefinitionEtymology.Etymons.Add(etymon.GetString());
}
tempDefinition.DefinitionEtymology.EtymologyType =
etymologyObject.GetProperty("etymology_type").ToString();

var eLanguage = etymologyObject.GetProperty("etymon_language").EnumerateArray();
while (eLanguage.MoveNext())
{
var eLangCurrent = eLanguage.Current;
tempDefinition.DefinitionEtymology.EtymonLanguage.Add(eLangCurrent.ToString());
}

var sourceLanguage = etymologyObject.GetProperty("source_language").EnumerateArray();
while (sourceLanguage.MoveNext())
{
var sourceLangCurrent = sourceLanguage.Current;
tempDefinition.DefinitionEtymology.EtymonLanguage.Add(sourceLangCurrent.ToString());
}

tempDefinition.DefinitionEtymology.EtymologySummary = etymologyObject.GetProperty("etymology_summary").ToString();
query.Definitions.Add(tempDefinition);
Console.WriteLine(query.Definitions.ToString());
}

query.HasLookedUpWord = true;
Expand Down
1 change: 1 addition & 0 deletions Definition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class Definition
public Definition() {
this.PartsOfSpeech = new List<string>();
this.FormattedPartsOfSpeech = new List<string>();

}

public void FormatPartsOfSpeech() {
Expand Down
Binary file modified bin/Debug/net5.0/OxfordV2.dll
Binary file not shown.
Binary file modified bin/Debug/net5.0/OxfordV2.pdb
Binary file not shown.
Binary file modified bin/Debug/net5.0/ref/OxfordV2.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion obj/Debug/net5.0/OxfordV2.csproj.CoreCompileInputs.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
817c88b68c5463f12adcf28f65cfec83e500dca5
90c697d3542028f533209b94f2559091febc26d6
Binary file modified obj/Debug/net5.0/OxfordV2.dll
Binary file not shown.
Binary file modified obj/Debug/net5.0/OxfordV2.pdb
Binary file not shown.
Binary file modified obj/Debug/net5.0/ref/OxfordV2.dll
Binary file not shown.

0 comments on commit b8ae0b9

Please sign in to comment.