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

New Feature: Lang Title #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

New Feature: Lang Title #100

wants to merge 2 commits into from

Conversation

alexsalo
Copy link

Get the title in specified language code.

Returns None if lang code or title isn't found, otherwise returns a string with title.

Use case (minimal):

import wikipedia as wk
page = wk.page('cv joint')
print page.lang_title('ru')

> Шарнир равных угловых скоростей

Use case (extended):

import wikipedia as wk
import langid
query_test = 'теория относительности'
langid.set_languages(['en', 'ru'])
detected_langid = langid.classify(query_test)[0]
print 'detected: ' + detected_langid
wk.set_lang(detected_langid)
page = wk.page(query_test)
print page.lang_title('en')

>detected: ru
>Theory of relativity

- Get the title in specified language code
    Returns None if lang code or title isn't found, otherwise returns a string with title.
@medecau medecau mentioned this pull request Feb 21, 2023
23 tasks
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.

1 participant