Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JMdict/JMnedict titles and Revision for KANJIDIC #24

Conversation

MarvNC
Copy link
Member

@MarvNC MarvNC commented Jul 24, 2024

For example, after this change:
Code_●_KANJIDIC_english json_-jmdict-yomitan-_Visual__2024-07-24_16-02-40

@Kuuuube
Copy link
Member

Kuuuube commented Jul 26, 2024

Is there a reason for not having a separate function with some validation for the kanjidic date like jmdict or jmnedict have? Is kanjidic formatted differently to where this is not needed?

func jmdictPublicationDate(dictionary jmdict.Jmdict) string {
	unknownDate := "unknown"
	idx := -1
	for i, entry := range dictionary.Entries {
	jmdictDate := jmdictPublicationDate(dictionary)
        ...

@MarvNC
Copy link
Member Author

MarvNC commented Jul 26, 2024

Because it's a one-liner as KANJIDIC is indeed formatted differently. For JMdict/JMnedict, the date is in a comment so we need to look at the JMdict entry for the date, while for KANJIDIC it's in the header so we can just access it.
https://github.com/themoeway/jmdict-go/blob/fa8f5d54f3647f9c24ce6079194cb4b8596bbf7b/kanjidic.go#L13-L25

type KanjidicHeader struct {
	// This field denotes the version of kanjidic2 structure, as more
	// than one version may exist.
	FileVersion string `xml:"file_version"`


	// The version of the file, in the format YYYY-NN, where NN will be
	// a number starting with 01 for the first version released in a
	// calendar year, then increasing for each version in that year.
	DatabaseVersion string `xml:"database_version"`


	// The date the file was created in international format (YYYY-MM-DD).
	DateOfCreation string `xml:"date_of_creation"`
}

Note I used the DatabaseVersion instead of the DateOfCreation as it reflects the last time the content was actually updated.

Copy link
Member

@Kuuuube Kuuuube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks for the clarification.

@MarvNC MarvNC merged commit 3aadf87 into yomidevs:main Jul 26, 2024
1 check passed
@MarvNC MarvNC deleted the 23-update-jmdictjmnedict-titles-and-revision-for-kanjidic branch July 26, 2024 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update JMdict/JMnedict titles and Revision for KANJIDIC
2 participants