Patches item #1729378, was opened at 2007-06-01 09:40
Message generated for change (Settings changed) made by purodha
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Purodha B Blissenbach (purodha)
Assigned to: Purodha B Blissenbach (purodha)
Summary: interwiki.py - add command line option -hintnobracket
Initial Comment:
Often you have page titles like "xyzname (specialcase)" in your language while others only have "xyzname".
In English, there are many page titles like "abc (disambiguation)", while other languages use "abc" for their disambiguations, and vice versa.
Both such cases can be more easily dealt with, when -askhint, -same, etc. automatically ignore the " (whatever there is in brackets) " upon request
Suggestion: Add a command line option -hintnobracket which does exactly that.
Attached is a patch which works for me.
Review is strongly suggested: I am not a python expert, and I am uncertain about negative side-effects. Most specifically, I did not check for other callers of the ameded translate.py
----------------------------------------------------------------------
Comment By: Purodha B Blissenbach (purodha)
Date: 2008-12-15 13:30
Message:
solved with revision 6149.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…
Patches item #1729378, was opened at 2007-06-01 09:40
Message generated for change (Settings changed) made by purodha
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Pending
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Purodha B Blissenbach (purodha)
Assigned to: Purodha B Blissenbach (purodha)
Summary: interwiki.py - add command line option -hintnobracket
Initial Comment:
Often you have page titles like "xyzname (specialcase)" in your language while others only have "xyzname".
In English, there are many page titles like "abc (disambiguation)", while other languages use "abc" for their disambiguations, and vice versa.
Both such cases can be more easily dealt with, when -askhint, -same, etc. automatically ignore the " (whatever there is in brackets) " upon request
Suggestion: Add a command line option -hintnobracket which does exactly that.
Attached is a patch which works for me.
Review is strongly suggested: I am not a python expert, and I am uncertain about negative side-effects. Most specifically, I did not check for other callers of the ameded translate.py
----------------------------------------------------------------------
Comment By: Purodha B Blissenbach (purodha)
Date: 2008-12-15 13:30
Message:
solved with revision 6149.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…
Patches item #1729378, was opened at 2007-06-01 09:40
Message generated for change (Comment added) made by purodha
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Purodha B Blissenbach (purodha)
Assigned to: Purodha B Blissenbach (purodha)
Summary: interwiki.py - add command line option -hintnobracket
Initial Comment:
Often you have page titles like "xyzname (specialcase)" in your language while others only have "xyzname".
In English, there are many page titles like "abc (disambiguation)", while other languages use "abc" for their disambiguations, and vice versa.
Both such cases can be more easily dealt with, when -askhint, -same, etc. automatically ignore the " (whatever there is in brackets) " upon request
Suggestion: Add a command line option -hintnobracket which does exactly that.
Attached is a patch which works for me.
Review is strongly suggested: I am not a python expert, and I am uncertain about negative side-effects. Most specifically, I did not check for other callers of the ameded translate.py
----------------------------------------------------------------------
Comment By: Purodha B Blissenbach (purodha)
Date: 2008-12-15 13:30
Message:
solved with revision 6149.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…
Patches item #1729378, was opened at 2007-06-01 09:40
Message generated for change (Settings changed) made by purodha
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Purodha B Blissenbach (purodha)
Assigned to: Purodha B Blissenbach (purodha)
Summary: interwiki.py - add command line option -hintnobracket
Initial Comment:
Often you have page titles like "xyzname (specialcase)" in your language while others only have "xyzname".
In English, there are many page titles like "abc (disambiguation)", while other languages use "abc" for their disambiguations, and vice versa.
Both such cases can be more easily dealt with, when -askhint, -same, etc. automatically ignore the " (whatever there is in brackets) " upon request
Suggestion: Add a command line option -hintnobracket which does exactly that.
Attached is a patch which works for me.
Review is strongly suggested: I am not a python expert, and I am uncertain about negative side-effects. Most specifically, I did not check for other callers of the ameded translate.py
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…
Revision: 6149
Author: purodha
Date: 2008-12-15 13:28:38 +0000 (Mon, 15 Dec 2008)
Log Message:
-----------
Add -hintnobracket parameter to interwiki.py
solving bug 1729378, https://sourceforge.net/support/tracker.php?aid=1729378
Modified Paths:
--------------
trunk/pywikipedia/interwiki.py
trunk/pywikipedia/titletranslate.py
Modified: trunk/pywikipedia/interwiki.py
===================================================================
--- trunk/pywikipedia/interwiki.py 2008-12-14 11:38:53 UTC (rev 6148)
+++ trunk/pywikipedia/interwiki.py 2008-12-15 13:28:38 UTC (rev 6149)
@@ -77,7 +77,8 @@
where to start looking for translations. This is only
useful if you specify a single page to work on. If no
text is given after the second ':', the name of the page
- itself is used as the title for the hint.
+ itself is used as the title for the hint, unless the
+ -hintnobracket command line option (see there) is also selected.
There are some special hints, trying a number of languages
at once:
@@ -123,6 +124,12 @@
dates, only use found links and hints.
(note: without ending colon)
+ -hintnobracket used to make the robot strip everything in brackets,
+ and surrounding spaces from the page name, before it is
+ used in a -hint:xy: where the page name has been left out,
+ or -hint:all:, -hint:10:, etc. without a name, or
+ an -askhint reply, where only a language is given.
+
These arguments define how much user confirmation is required:
-autonomous run automatically, do not ask any questions. If a question
@@ -456,6 +463,7 @@
untranslatedonly = False
askhints = False
auto = True
+ hintnobracket = False
neverlink = []
showtextlink = 0
showtextlinkadd = 300
@@ -546,11 +554,14 @@
"""Add the given translation hints to the todo list"""
if globalvar.same:
if hints:
- pages = titletranslate.translate(self.originPage, hints = hints + ['all:'], auto = globalvar.auto)
+ pages = titletranslate.translate(self.originPage, hints = hints + ['all:'], auto = globalvar.auto, removebrackets
+= globalvar.hintnobracket)
else:
- pages = titletranslate.translate(self.originPage, hints = ['all:'], auto = globalvar.auto)
+ pages = titletranslate.translate(self.originPage, hints = ['all:'], auto = globalvar.auto, removebrackets
+= globalvar.hintnobracket)
else:
- pages = titletranslate.translate(self.originPage, hints = hints, auto = globalvar.auto)
+ pages = titletranslate.translate(self.originPage, hints = hints, auto = globalvar.auto, removebrackets
+= globalvar.hintnobracket)
for page in pages:
self.todo.append(page)
self.foundIn[page] = [None]
@@ -758,7 +769,8 @@
elif not newhint:
break
else:
- pages = titletranslate.translate(self.originPage, hints = [newhint], auto = globalvar.auto)
+ pages = titletranslate.translate(self.originPage, hints = [newhint], auto = globalvar.auto, removebrackets
+= globalvar.hintnobracket)
for page in pages:
self.addIfNew(page, counter, None)
@@ -1617,6 +1629,8 @@
globalvar.askhints = True
elif arg == '-noauto':
pass
+ elif arg == '-hintnobracket':
+ globalvar.hintnobracket = True
elif arg.startswith('-warnfile:'):
warnfile = arg[10:]
elif arg == '-confirm':
Modified: trunk/pywikipedia/titletranslate.py
===================================================================
--- trunk/pywikipedia/titletranslate.py 2008-12-14 11:38:53 UTC (rev 6148)
+++ trunk/pywikipedia/titletranslate.py 2008-12-15 13:28:38 UTC (rev 6149)
@@ -11,7 +11,7 @@
import wikipedia, date, time
-def translate(page, hints = None, auto = True):
+def translate(page, hints = None, auto = True, removebrackets = False):
"""
Please comment your source code! --Daniel
@@ -30,13 +30,16 @@
if newname == '':
# if given as -hint:xy or -hint:xy:, assume that there should
# be a page in language xy with the same title as the page
- # we're currently working on
+ # we're currently working on ...
ns = page.namespace()
if ns:
newname = u'%s:%s' % (site.family.namespace('_default', ns), page.titleWithoutNamespace())
else:
# article in the main namespace
newname = page.title()
+ # ... unless we do want brackets
+ if removebrackets:
+ newname = re.sub(re.compile(ur"\W*?\(.*?\)\W*?", re.UNICODE), u" ", newname)
try:
number = int(codes)
codes = site.family.languages_by_size[:number]
Patches item #1729378, was opened at 2007-06-01 09:40
Message generated for change (Settings changed) made by purodha
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Purodha B Blissenbach (purodha)
>Assigned to: Purodha B Blissenbach (purodha)
Summary: interwiki.py - add command line option -hintnobracket
Initial Comment:
Often you have page titles like "xyzname (specialcase)" in your language while others only have "xyzname".
In English, there are many page titles like "abc (disambiguation)", while other languages use "abc" for their disambiguations, and vice versa.
Both such cases can be more easily dealt with, when -askhint, -same, etc. automatically ignore the " (whatever there is in brackets) " upon request
Suggestion: Add a command line option -hintnobracket which does exactly that.
Attached is a patch which works for me.
Review is strongly suggested: I am not a python expert, and I am uncertain about negative side-effects. Most specifically, I did not check for other callers of the ameded translate.py
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1729378&group_…