BO API is a free data Service API (http://www.boapi.net/), its word query interface http://service.boapi.net/enword/enword.ashx?key=appkey& Type=w&word=good, where Appkey is the application of the Key,word is the queried word. See http://www.boapi.net/enword.htm for detailed documentation.
Development language: C # (WPF)
Tool: VS2012
Key code
1 Private voidbtnSearch_Click (Objectsender, RoutedEventArgs e)2 {3 stringWord =TbKey.Text.Trim ();4 if(Word = ="")5 return;6 Try7 {8WebClient WC =NewWebClient ();9Wc. Encoding =System.Text.Encoding.UTF8;Ten stringJSON = WC. Downloadstring ("http://service.boapi.net/EnWord/EnWord.ashx?appkey=298fc40c3be17b1b94e2f&word="+word); One WC. Dispose (); A if(!string. IsNullOrEmpty (JSON)) - { -Jtoken JK =(Jtoken) jsonconvert.deserializeobject (JSON); the if(JK! =NULL) - { -Tbword.text =Word; -Tbphonetic.text ="["+ jk["Mark"]. ToString () +"]"; +Tbtrans.text = jk["explain"]. ToString (); -Voice. Visibility =visibility.visible; +Voice. Tag ="http://www.boapi.net/basicdata/voice/"+ Word. Substring (0,1) +"/"+ jk["Voice"]. ToString (); A if(jk["es"] !=NULL) at { - if(jk["es"]. Count () >0) -Tbsentence.text = jk["es"][0]["sentence"]. ToString () +" "+ jk["es"][0]["Translate"]. ToString (); - if(jk["es"]. Count () >1) -Tbsentence.text + = Environment.NewLine + jk["es"][1]["sentence"]. ToString () +" "+ jk["es"][1]["Translate"]. ToString (); - //if (jk["es"). Count () > 2) in //Tbsentence.text + = Environment.NewLine + jk["es"][2]["sentence"]. ToString () + "" + jk["es"][2]["translate"]. ToString (); - } to } + } - } the Catch * { } $}
Code parsing:
WebClient provides a public way to receive data from the resource, we can download the data from the remote URL address (access the service).
Jsonconvert.deserializeobject to deserialize a string into a JSON object
Voice is a play icon, where the audio file address of a word is stored in the Voice's Tag property
Attention:
In the JSON returned by the word query, voice represents the word voice file name. The URL of the Access speech file is: http://www.boapi.net/basicdata/voice/word filename
such as: Query good word returned in the JSON "Voice": "Good.wav", the good word URL is http://www.boapi.net/basicdata/voice/good.wav
Source code Download: Word Query software source code
Use the BO API to develop word-search small software