Package: sakuraParisAPI
The Unofficial Sakura Paris Python API (TUSPPAPI)✨Because one dictionary is never enough✨Table of ContentsMore than just a wrapper (Intro)Install the PackageDocumentationMore than just a wrapperHave you ever wanted to search 40 different Japanese dictionaries at the same time? Well now you can anyways!Introducing the wrapper that queries thesakura-paris's free Koujien search API（広辞苑無料検索） for a lot of dictionaries. This includes Daijirin, Koujien, Daijisen, and even oddballs like a dictionary for psychological terms（心理学辞典）.If that wasn't enough, this wrapper allows you to query selected dictionaries at the same time, and also allows searches over the 40 entry limit on sakura-paris! If you've ever been at a loss for which dictionary to pick, you're at the right place!That's enough talk. Here's an example of how easy it is to use.#import the package!fromsakuraParisAPI.sakuraimportJpDict#create JpDict objecta=JpDict()#each dictionary will return at most 10 entries (default value is already 10)a.setMax(10)#add dictionary to be queries ("広辞苑" is added by default, so this will query 2 dictionaries)a.addDict("大辞林")#returns a dictionary where [key = dictionary_name, value = list of Entry]results=a.search("元気")#for every dictionary queriedforkeyinresults:print("______",key,"______")#for every entry found in dictionaryforentryinresults[key]:#print out the word and its definitionprint(entry.getHeading())print(entry.getDefinition())print()#print out all dictionaries used in this queryprint(a.getDict())Also, by adding a single line before callingsearch(word), we can query all dictionaries at the same time.a.addAllDict()andvoila. 40 dictionaries at your fingertips. Minus a couple cause the API returns empty jsons for them. :')Install the PackageThis package can be downloaded using PIP!Here is the command for the latest version:pip install sakuraParisAPI==0.1.0SPPAPI has two dependencies: bs4 and requests, and both will also be installed by the above commandDocumentationAll public methods of the JpDict and Entry class are listed below.Please note that the API does not work with a few dictionaries (e.g. 学研古語辞典, NHK日本語発音アクセント辞典). I will be using bs4 or something similar to implement these features later. Especially for the NHK accent dictionary, I hope to return the links to the .wav files for each entry.JpDict MethodParameter TypesReturn TypeDescriptionsearch(word, searchType = 0)str, int (0 - 2)dict[str, list[Entry]]queries active dictionaries forwordwith search typesearchType.searchtype = 0by default and searches for dictionary entries with prefixes matchingword.searchtype = 1searches for suffixes matchingwordandsearchtype = 2searches for exact matches only.Returns a dictionary where keys are the name of the dictionary queried and value is a list ofEntrystartsWith(word)strdict[str, list[Entry]]Queries dictionary for entries that start withword. Same return type assearch.endsWith(word)strdict[str, list[Entry]]Queries dictionary for entries that end withword. Same return type assearch.completeMatch(word)strdict[str, list[Entry]]Queries dictionary for entries that are exact matches forword. Same return type assearch.setMax(maxEntries)intvoidSets the max number of entries (for each dictionary) returned by any of the above functions tomaxEntriesaddDict(dictionaryName)strvoidaddsdictionaryNameto set of dictionaries to be queried if it exists.addAllDict()voidadds all possible dictionaries to set of dictionaries to be queried.enableTags()voidprevents markdown tags from being removed from theheadinganddefinitionfields ofEntrys returned in searches.disableTags()voidensures markdown tags are removed from theheadinganddefinitionfields ofEntrys returned in searches.Entry MethodParameter TypesReturn TypeDescriptiongetHeading()strreturns heading listed in dictionary entry.getDefinition()strreturns the definition listed in dictionary entry.getPage()strreturns page number of dictionary entrygetOffset()strreturns the offset of the dictionary entryNote:getPage()andgetOffset()do not currently have any use.