Module: WWWJDic
- Defined in:
- lib/wwwjdic.rb,
lib/wwwjdic/parser.rb,
lib/wwwjdic/version.rb,
lib/wwwjdic/constants.rb,
lib/wwwjdic/application.rb,
lib/wwwjdic/parsers/key.rb,
lib/wwwjdic/parsers/dict.rb,
lib/wwwjdic/utils/raisers.rb,
lib/wwwjdic/parsers/search.rb,
lib/wwwjdic/parsers/server.rb,
lib/wwwjdic/utils/splitter.rb,
lib/wwwjdic/parsers/display.rb,
lib/wwwjdic/utils/downloader.rb
Overview
– wwwjdic rubocop:disable Style/AsciiComments © 2014-2021 Marco Bresciani rubocop:enable Style/AsciiComments
This file is part of wwwjdic.
wwwjdic is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
wwwjdic is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with wwwjdic. If not, see <www.gnu.org/licenses/>.
SPDX-FileCopyrightText: 2014-2021 Marco Bresciani
SPDX-License-Identifier: GPL-3.0-or-later ++
Defined Under Namespace
Modules: Parsers, Utils Classes: Parser, Splitter, WWWJDic
Constant Summary collapse
- VERSION =
Current version number for WWWJDic gem.
'16.1.0'- ALLOWED_PARAMS =
Allowed parameters for configuration
i[dict display key server].freeze
- ALL_PARAMS =
All parameters for configuration
ALLOWED_PARAMS + [:search]
- AVAIL_LANGS =
Numeric codes for language-specific dictionaries
{ en: '1', de: 'G', fr: 'H', ru: 'I', sv: 'J', hu: 'K', es: 'L', nl: 'M', sl: 'N', it: 'O' }.freeze
- DICTIONARY_CODES =
Numeric codes for dictionaries usage
[('1'..'9').to_a, ('A'..'R').to_a].flatten
- DICTIONARY_NAMES =
Naming for all supported dictionaries
['Jpn-Eng General (EDICT)', 'Japanese Names (ENAMDICT)', 'Computing/Telecomms', 'Life Sciences/Bio-Med', 'Legal Terms', 'Finance/Marketing', 'Buddhism', 'Miscellaneous', 'Special Text-glossing', 'Engineering/Science', 'Linguistics', 'River & Water Systems', 'Automobile Industry', 'Japanese Wordnet', 'Work-in-progress File', 'Japanese-German (WaDoku)', 'Japanese-French', 'Japanese-Russian', 'Japanese-Swedish', 'Japanese-Hungarian', 'Japanese-Spanish', 'Japanese-Dutch', 'Japanese-Slovenian', 'Japanese-Italian', 'Untranslated', 'Combined Jpn-Eng', 'Expanded Text-glossing'].freeze
- DICTS_BY_CODES =
Mapping between dictionaries names with codes
DICTIONARY_CODES.zip(DICTIONARY_NAMES).to_h
- DICTS_BY_NAMES =
Mapping between dictionaries codes with names
DICTIONARY_NAMES.zip(DICTIONARY_CODES).to_h
- DISPLAY =
Display modes
{ regular: 'M', raw: 'Z' }.freeze
- KEYS =
k is the key type:
for dictionary lookups for English keys use E, or P to get just "common words", Qto get an “exact match” and R to get both;
for Japanese keys use J (this is mandatory for romaji keys),P to get just “common words” (doesn’t work with romaji), K for keys starting with kanji (first position), and L for kanji keys in any position.
for kanji lookups, use M followed by the KANJIDIC letter codes(B, U, V, N, etc.) or J if a reading or kanji is being provided. An optional stroke-count or stroke-count range can be included by placing it between “=” characters;
for text glossing use G, or H to turn on the "no repeatedtranslations“ option.
for multi-radical kanji lookups use J for jouyou kanji-only, Hto include JIS X 0212 kanji, and X for anything else. An optional stroke-count or stroke-count range can be included by placing it between “=” characters.
for example sentence lookups with indexed words use E for EUC,ISO-2022-JP or UCS, S for Shift_JIS and U for UTF-8, followed by “lookupword=n=kana=”. The kana is optional and is there to disambiguate between different headwords. For “n”, 1 => random selection of 10, anything else => display up to 100 sentences starting at n.
for example sentence lookups using a regular expression, use Efor EUC, ISO-2022-JP or UCS, S for Shift_JIS and U for UTF-8, followed by the search string. Up to 99 example sentences may be displayed.
{ english: 'E', common: 'P', exact: 'Q', both: 'R', japanese: 'J', start_kanji: 'K', any_kanji: 'L', kanji: 'M', glossing: 'G', no_repeated: 'H', jis_kanji: 'H', multi_radical: 'X' }.freeze
- KANJIDIC_CODES =
KANJIDIC letter codes (see www.edrdg.org/kanjidic/kanjidic.html)
- U
-
the Unicode/ISO 10646 code of the kanji in hexadecimal;
- N
-
the index in Nelson (Modern Reader’s Japanese-English Character
Dictionary)
- B
-
the classification radical number of the kanji (as in Nelson);
- C
-
the “classical” radical number (where this differs from the one
used in Nelson);
- S
-
the total stroke-count of the kanji;
- G
-
the “grade” of the kanji, In this case, G2 means it is a Jouyou
(general use) kanji taught in the second year of elementary schooling in Japan;
- H
-
the index in Halpern (New Japanese-English Character
Dictionary);
- F
-
the rank-order frequency of occurrence of the kanji in Japanese;
- P
-
the “SKIP” coding of the kanji, as used in Halpern;
- K
-
the index in the Gakken Kanji Dictionary (A New Dictionary of
Kanji Usage);
- L
-
the index in Heisig (Remembering The Kanji);
- I
-
the index in the Spahn & Hadamitsky dictionary.
- Q
-
the Four-Corner code;
- MN,MP
-
the index and page number in the 13-volume Morohashi
“DaiKanWaJiten”;
- E
-
the index in Henshall (A Guide To Remembering Japanese
Characters);
- Y
-
the PinYin (Chinese) pronunciation(s) of the kanji;
{ unicode: 'U', nelson: 'N', radical: 'B', classical: 'C', stroke: 'S', grade: 'G', halpern: 'H', frequency: 'F', skip: 'P', gakken: 'K', heisig: 'L', spahn: 'I', corner: 'Q', morohashi_index: 'MN', morohashi_page: 'MP', henshall: 'E', pinyin: 'Y' }.freeze
- URI_DEFAULT =
Reference URI for Backdoor Entry/API
'http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?'- URI_OLD =
Monash URI for Backdoor Entry/API
'http://nihongo.monash.edu/cgi-bin/wwwjdic?'- URIS =
URIs for Backdoor Entry/API
{ edrdg: URI_DEFAULT, monash: URI_OLD }.freeze
Class Method Summary collapse
-
.breener ⇒ Object
Creates a new WWWJDic object (from the verb ‘to Breen’… :) ).
-
.parser ⇒ Object
Provides the parameters’ parsers object.
Class Method Details
.breener ⇒ Object
Creates a new WWWJDic object (from the verb ‘to Breen’… :) ).
- Usage
-
new_wwwjdic = WWWJDic::breener
-
- Returns
-
a
WWWJDicobject.
44 45 46 |
# File 'lib/wwwjdic.rb', line 44 def self.breener WWWJDic.new(parser) end |
.parser ⇒ Object
Provides the parameters’ parsers object.
49 50 51 52 53 54 55 |
# File 'lib/wwwjdic.rb', line 49 def self.parser parsers = { dict: Parsers::Dict.new, display: Parsers::Display.new, key: Parsers::Key.new, search: Parsers::Search.new, server: Parsers::Server.new } Parser.new parsers end |