Skip to content

GHRik/SjpAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SjpAPI - Android version

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

Tables of contents:

  1. Do i need this API?
  2. How it works?
  3. Features
  4. Used technology
  5. Installation
  6. Using API
  7. Examples using
  8. License

.

Do i need this API?

When you need this API:

When you dont need this API:

  • 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.

.

How it works

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: schema

- According to this dependencies any small changes in sjp.pl site
- might make SjpAPI unusable.
+ I will try to support if needed :D

Examples Http outputs

Http output when i try to reach word: "zamek" https://sjp.pl/zamek Zamek_find Http output when i try to reach word who is not in dictionary: Not_find_in_dictionary

.

Features

  • 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.

.

Tech

Used technology

.

Installation

  1. Add sjpApi.jar as extended library to your java project and import:
import com.sjp.sjpapi.SjpAPI;

.

Using

  1. Import
import com.sjp.sjpapi.SjpAPI;
  1. 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"}
Means of json field:
  • 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"}

.

Examples:

To easy ilustrate i created easy android app, so you are free to test it:

When you input empty string OR is problem with connect to site(no internet connection):

Empty_string

Input: "zamek":

Zamek_example

Not found in dictionary:

Not_find_in_dictionary_Example

BAD FORMATING site:

Bad_Format

.

License

Apache

About

Słownik języka polskiego SJP (SJP.PL) - API do łatwego łapania słówek. ENG: API to easy get words from polish dictionary(SJP.PL)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages