Compare commits

..

11 Commits

Author SHA1 Message Date
cc9bc30b68 Update README 2022-07-14 14:16:40 -07:00
2e3194aa18 Update package location to foosoft.net 2022-07-03 20:41:16 -07:00
Alex Yatskov
221e25544d
Merge pull request #3 from TomRomeo/master
Add sense attribute "example" for JMdict files with examples
2022-04-17 09:02:08 -07:00
Tom Romeo
81e4b4ba8e
Add sense attribute "example" for JMdict files with examples 2022-04-16 18:31:29 +02:00
Alex Yatskov
5dd00f3bcb
Merge pull request #2 from stephenmk/master
Add glossary attribute "g_type" for jmdict Rev 1.09
2022-03-30 09:31:49 -07:00
Stephen Kraus
3a04f83b51
Clarify currently used values for xml attribute g_type 2022-03-26 20:36:55 -05:00
Stephen Kraus
b77b2f92fd
Add glossary attribute "g_type" for jmdict Rev 1.09 2022-03-24 17:27:19 -05:00
8c7ddb0c20 Add site metadata 2021-12-14 17:38:56 -08:00
a81499578b Update README 2021-06-08 21:04:28 -07:00
Alex Yatskov
808d66c7b0
Merge pull request #1 from searls/patch-1
Fix link in README
2019-09-25 21:56:29 -07:00
Justin Searls
1bad2ace3a
Fix link in README
JMDict link was pointing the proper names dictionary, was probably just a copy-paste error
2019-09-25 16:12:13 +09:00
7 changed files with 47 additions and 92 deletions

View File

@ -1,4 +1,4 @@
Copyright 2016-2019 Alex Yatskov
Copyright 2016-2022 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

View File

@ -1,12 +1,14 @@
# JMDict #
# JMDict
JMDict is a simple library written in Go for parsing the raw data files for the
[JMDict](http://www.edrdg.org/enamdict/enamdict_doc.html) (vocabulary)
[JMDict](http://www.edrdg.org/jmdict/j_jmdict.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/github.com/FooSoft/jmdict) for a
creation of this library. Please see the [documentation page](https://godoc.org/foosoft.net/projects/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.

View File

@ -1,25 +1,3 @@
/*
* 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 (

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module foosoft.net/projects/jmdict
go 1.18

View File

@ -1,25 +1,3 @@
/*
* 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"
@ -170,6 +148,13 @@ 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 {
@ -229,6 +214,37 @@ 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) {

View File

@ -1,25 +1,3 @@
/*
* 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"

View File

@ -1,25 +1,3 @@
/*
* 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"