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

Disambiguation not always detected #306

Open
ManavR123 opened this issue Mar 30, 2022 · 2 comments
Open

Disambiguation not always detected #306

ManavR123 opened this issue Mar 30, 2022 · 2 comments

Comments

@ManavR123
Copy link

I'm trying to find terms on Wikipedia that are specifically unambiguous so I was hoping that I could detect ambiguity by just catching the DisambiguationError, but it seems there are some cases where this doesn't work. Can someone explain the following example? Why isn't Acceleration being caught as ambiguous unless I specifically look for the disambiguation page?

>>> wikipedia.summary("Bert", auto_suggest=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/util.py", line 28, in __call__
    ret = self._cache[key] = self.fn(*args, **kwargs)
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 231, in summary
    page_info = page(title, auto_suggest=auto_suggest, redirect=redirect)
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 276, in page
    return WikipediaPage(title, redirect=redirect, preload=preload)
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 299, in __init__
    self.__load(redirect=redirect, preload=preload)
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 393, in __load
    raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)
wikipedia.exceptions.DisambiguationError: "Bert" may refer to: 
Bert (name)
Bert (Sesame Street)
Bert (horse)
Bert (Mary Poppins)
Iron Bert
Berd
Bert, Allier
Bert, West Virginia
Q*bert
Bit error rate test
Bit error rate tester
Bert (TV series)
HP Bert
BERT (language model)
Here Comes a Song
All pages with titles beginning with Bert
Bert Diaries
Birt (disambiguation)
Burt (disambiguation)
>>> wikipedia.summary("Acceleration", auto_suggest=False)
"In mechanics, acceleration is the rate of change of the velocity of an object with respect to time. Accelerations are vector quantities (in that they have magnitude and direction). The orientation of an object's acceleration is given by the orientation of the net force acting on that object. The magnitude of an object's acceleration, as described by Newton's Second Law, is the combined effect of two causes:\n\nthe net balance of all external forces acting onto that object — magnitude is directly proportional to this net resulting force;\nthat object's mass, depending on the materials out of which it is mademagnitude is inversely proportional to the object's mass.The SI unit for acceleration is metre per second squared (m⋅s−2, \n  \n    \n      \n        \n          \n            \n              m\n              \n                s\n                \n                  2\n                \n              \n            \n          \n        \n      \n    \n    {\\displaystyle {\\tfrac {\\operatorname {m} }{\\operatorname {s} ^{2}}}}\n  ).\nFor example, when a vehicle starts from a standstill (zero velocity, in an inertial frame of reference) and travels in a straight line at increasing speeds, it is accelerating in the direction of travel. If the vehicle turns, an acceleration occurs toward the new direction and changes its motion vector.  The acceleration of the vehicle in its current direction of motion is called a linear (or tangential during circular motions) acceleration, the reaction to which the passengers on board experience as a force pushing them back into their seats. When changing direction, the effecting acceleration is called radial (or orthogonal during circular motions) acceleration, the reaction to which the passengers experience as a centrifugal force. If the speed of the vehicle decreases, this is an acceleration in the opposite direction and mathematically a negative, sometimes called deceleration or retardation , and passengers experience the reaction to deceleration as an inertial force pushing them forward.  Such negative accelerations are often achieved by retrorocket burning in spacecraft. Both acceleration and deceleration are treated the same, as they are both changes in velocity. Each of these accelerations (tangential, radial, deceleration) is felt by passengers until their relative (differential) velocity are neutralized in reference to the vehicle."
>>> wikipedia.summary("Acceleration (disambiguation)", auto_suggest=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/util.py", line 28, in __call__
    ret = self._cache[key] = self.fn(*args, **kwargs)
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 231, in summary
    page_info = page(title, auto_suggest=auto_suggest, redirect=redirect)
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 276, in page
    return WikipediaPage(title, redirect=redirect, preload=preload)
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 299, in __init__
    self.__load(redirect=redirect, preload=preload)
  File "/home/manav/s2orc/env/lib/python3.6/site-packages/wikipedia/wikipedia.py", line 393, in __load
    raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)
wikipedia.exceptions.DisambiguationError: "Acceleration (disambiguation)" may refer to: 
Acceleration (biology)
Acceleration (differential geometry)
Acceleration (human)
Acceleration (law)
Academic acceleration
Cardiotocographic acceleration
throttle
The sensation
Series acceleration
Acceleration (album)
Acceleration (film)
Accelerate (disambiguation)
Accelerationism
Accelerator (disambiguation)

Thanks for the help!

@santwanac
Copy link

I have been facing the same issue. How to deal with this?

@lahdjirayhan
Copy link

lahdjirayhan commented May 14, 2023

I visited Wikipedia to check this.

Putting "bert" into the search bar returns https://en.wikipedia.org/wiki/Bert which is a disambiguation page.

Putting "acceleration", however, returns this https://en.wikipedia.org/wiki/Bert which is a normal article page.


Knowing this is Wikipedia's behavior, I am not sure if it can be fixed from within this library.

Perhaps the library can try to "catch" if an article could be ambiguous?

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

No branches or pull requests

3 participants