-
Notifications
You must be signed in to change notification settings - Fork 279
Add Thai word list from Thai Wikipedia titles #869
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
376ea3d
Add: wikipedia titles data
konbraphat51 d1da1bd
Change file name
konbraphat51 62c47b4
Add: wikipedia_titels()
konbraphat51 d6bc1a9
Add: init redirection for wikipedia_titles()
konbraphat51 0c80c12
Add: testcode of wikipedia_titles()
konbraphat51 6b5283b
Add: license description
konbraphat51 8d42633
Add: empty line
konbraphat51 8aad114
Small editorial changes to wikipedia_titles.py
bact ced0061
Update docstring in wikipedia_titles.py
bact 81eb005
Update wikipedia_titles.py
bact f9a4da8
Reorder import
konbraphat51 6a2a3f1
Added date of the data
konbraphat51 f04f843
Merge pull request #7 from PyThaiNLP/dev
konbraphat51 3e21b91
Merge branch 'dev' into corpus_wiki
konbraphat51 633f06d
Merge branch 'corpus_wiki' of https://github.com/konbraphat51/pythain…
konbraphat51 d928069
Fix: duplication
konbraphat51 310be12
Update corpus_license.md
bact 17946a6
Update test_corpus.py
bact 5848a06
Sort imports __init__.py
bact 0b52e14
Update wikipedia_titles.py
bact File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (C) 2016-2023 PyThaiNLP Project | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
""" | ||
Provides an optional word list from Thai Wikipedia titles. | ||
""" | ||
from typing import FrozenSet | ||
|
||
from pythainlp.corpus.common import get_corpus | ||
|
||
_WIKIPEDIA_TITLES = None | ||
_WIKIPEDIA_TITLES_FILENAME = "wikipedia_titles.txt" | ||
|
||
|
||
def wikipedia_titles() -> FrozenSet[str]: | ||
""" | ||
Return a frozenset of words in the Thai Wikipedia titles corpus. | ||
|
||
The data file is at pythainlp/corpus/wikipedia_titles.txt | ||
The word list has beed prepared by the code at: | ||
https://github.com/konbraphat51/Thai_Dictionary_Cleaner | ||
|
||
:return: :class:`frozenset` containing words in Thai Wikipedia titles corpus. | ||
:rtype: :class:`frozenset` | ||
""" | ||
global _WIKIPEDIA_TITLES | ||
if not _WIKIPEDIA_TITLES: | ||
_WIKIPEDIA_TITLES = get_corpus(_WIKIPEDIA_TITLES_FILENAME) | ||
|
||
return _WIKIPEDIA_TITLES |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind to add date of the Wikipedia data here please?
The date that you have downloaded the data for your preparation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's definitely required. Added!