API to easy get word from www.sjp.pl
SjpAPI was created to get info ONLINE of any word from Słownik języka polskiego site
For example:
- Check is word in dictionary
- Check if word can be used in game like scrabble
- Print all of meaning of a word
- Do i need this API?
- How it works?
- Features
- Used technology
- Installation
- Using API
- Examples using
- License
- Get "as fresh as tropical fruit"(ONLINE) meaning of any word in dictionary "słownik języka polskiego"
- Only need check word is in dictionary or can be used in game like scrabble. In this case you can check any link from there resolve your problem.
It is very simple. I locate all GET output from searching word is similary. For example:
- Any name of word is in "h1" tag
- Any info about word can be used game like scrabble is under word name.
- Any meaning of word is under "znaczenie:"
So to this dependencies i create schema:
- According to this dependencies any small changes in sjp.pl site
- might make SjpAPI unusable.
+ I will try to support if needed :D
Http output when i try to reach word: "zamek" https://sjp.pl/zamek
Http output when i try to reach word who is not in dictionary:
- Print word in JSON format
- Use like .jar library
SjpAPI is a library which "check" word online. I know all necesarry word can be found there, but sjp team working all the time with which word can be used in game like scrabble and it is not possible to get meaning of any word from site above. In this case this API was created.
Used technology
- Android studio - To develop and test API
- JUnit - To test API
- Java 8 - Languege used in API
- Słownik Języka Polskiego - Site which polish dictionary
- Apache StringUtils - Used in a small string operations ;)
- Add sjpApi.jar as extended library to your java project and import:
import com.sjp.sjpapi.SjpAPI;
- Import
import com.sjp.sjpapi.SjpAPI;
- Example of word "owoc":
String json = SjpAPI.getWord("owoc");
Output from example:
{"name":"owoc","count":1,"canBeUsed[0]":true,"variant[0]":"owoc","meaning[0]":"1. występujący u roślin okrytozalążkowych wytwór zalążni słupka kwiatowego;\n2. rezultat działań, wynik, skutek;\n3. potocznie, zbiorowo: płody drzew oraz krzewów owocowych"}
- Name: Name of searching word
- Count: How many meaning word have
- canBeUsed[index]: this word as meaning[index] can be used in game like scrabble
- viariant[index]: this field is point from which word searching word is created. For example if you searching for: "równe" , one of the variant is "równa" or "równy" check it out
- meaning[index]: one of meaning of word
Sometimes a sjp.pl site is in bad format and it is unavailable to read "meaning" of word. Look at this issue So in this case a output from "meaning[index]" field is "BAD FORMAT" , you can see in example below.
For example: Searching for word "wypasać"
String json = SjpAPI.getWord("wypasać");
Output from example:
{"name":"wypasać","count":1,"canBeUsed[0]":true,"variant[0]":"wypasać","meaning[0]":"BAD FORMAT"}
To easy ilustrate i created easy android app, so you are free to test it:
Apache