Compare commits
No commits in common. "cc9bc30b68a369dd9b17b756ed37f314808bc5f0" and "7e9f57b11310c71670c46af5d8301a2683eead32" have entirely different histories.
cc9bc30b68
...
7e9f57b113
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
||||
Copyright 2016-2022 Alex Yatskov
|
||||
Copyright 2016-2019 Alex Yatskov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
@ -1,14 +1,12 @@
|
||||
# JMDict
|
||||
# JMDict #
|
||||
|
||||
JMDict is a simple library written in Go for parsing the raw data files for the
|
||||
[JMDict](http://www.edrdg.org/jmdict/j_jmdict.html) (vocabulary)
|
||||
[JMDict](http://www.edrdg.org/enamdict/enamdict_doc.html) (vocabulary)
|
||||
[JMnedict](http://www.edrdg.org/enamdict/enamdict_doc.html) (names), and
|
||||
[KANJIDIC](http://nihongo.monash.edu/kanjidic2/index.html) (Kanji) dictionaries. As far as I know, these are the only
|
||||
publicly available Japanese dictionaries and are therefore used by a variety of tools (including
|
||||
[Yomichan-Import](https://foosoft.net/projects/yomichan-import) from this site).
|
||||
|
||||
The XML format used to store dictionary entries and entity data was deceptively annoying to work with, leading to the
|
||||
creation of this library. Please see the [documentation page](https://godoc.org/foosoft.net/projects/jmdict) for a
|
||||
creation of this library. Please see the [documentation page](https://godoc.org/github.com/FooSoft/jmdict) for a
|
||||
technical overview of how to use this library.
|
||||
|
||||
Please import this library from `foosoft.net/projects/jmdict` and not the GitHub path.
|
||||
|
22
common.go
22
common.go
@ -1,3 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Alex Yatskov <alex@foosoft.net>
|
||||
* Author: Alex Yatskov <alex@foosoft.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package jmdict
|
||||
|
||||
import (
|
||||
|
60
jmdict.go
60
jmdict.go
@ -1,3 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Alex Yatskov <alex@foosoft.net>
|
||||
* Author: Alex Yatskov <alex@foosoft.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package jmdict
|
||||
|
||||
import "io"
|
||||
@ -148,13 +170,6 @@ type JmdictGlossary struct {
|
||||
// a noun in the target language. When absent, the gender is either
|
||||
// not relevant or has yet to be provided.
|
||||
Gender *string `xml:"g_gend"`
|
||||
|
||||
// g_type attribute added in jmdict Rev 1.09
|
||||
// At present the values used are "lit", "fig", "expl" and "tm". It is
|
||||
// proposed to add a "descr" value to indicate a gloss which is a
|
||||
// description of the Japanese term rather than a translation or an
|
||||
// explanation of the meaning.
|
||||
Type *string `xml:"g_type,attr"`
|
||||
}
|
||||
|
||||
type JmdictSense struct {
|
||||
@ -214,37 +229,6 @@ type JmdictSense struct {
|
||||
// Japanese word. This element would normally be present, however it
|
||||
// may be omitted in entries which are purely for a cross-reference.
|
||||
Glossary []JmdictGlossary `xml:"gloss"`
|
||||
|
||||
// Some JMdict entries can contain 0 or more examples
|
||||
Examples []JmdictExample `xml:"example"`
|
||||
}
|
||||
|
||||
type JmdictExample struct {
|
||||
// Each example has a Srce element that indicates the source of the example
|
||||
// the source is typically the Tatoeba Project
|
||||
Srce JmdictExampleSource `xml:"ex_srce"`
|
||||
|
||||
// The term associated with this example
|
||||
Text string `xml:"ex_text"`
|
||||
|
||||
// Contains the Example sentences
|
||||
Sentences []JmdictExampleSentence `xml:"ex_sent"`
|
||||
}
|
||||
|
||||
type JmdictExampleSource struct {
|
||||
// The id of the example for the source
|
||||
ID string `xml:",chardata"`
|
||||
|
||||
// The source type (i.e. 'tat' for tatoeba)
|
||||
SrcType string `xml:"exsrc_type,attr"`
|
||||
}
|
||||
|
||||
type JmdictExampleSentence struct {
|
||||
// The language of the example sentence
|
||||
Lang string `xml:"lang,attr"`
|
||||
|
||||
// The example sentence text
|
||||
Text string `xml:",chardata"`
|
||||
}
|
||||
|
||||
func LoadJmdict(reader io.Reader) (Jmdict, map[string]string, error) {
|
||||
|
22
jmnedict.go
22
jmnedict.go
@ -1,3 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Alex Yatskov <alex@foosoft.net>
|
||||
* Author: Alex Yatskov <alex@foosoft.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package jmdict
|
||||
|
||||
import "io"
|
||||
|
22
kanjidic.go
22
kanjidic.go
@ -1,3 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Alex Yatskov <alex@foosoft.net>
|
||||
* Author: Alex Yatskov <alex@foosoft.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package jmdict
|
||||
|
||||
import "io"
|
||||
|
Loading…
Reference in New Issue
Block a user