Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
4a0c76ed
Commit
4a0c76ed
authored
Jan 11, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for english_number_a/process_english_hints to detect when "a" should be "an".
parent
74431a93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
src/script/functions/english.cpp
src/script/functions/english.cpp
+21
-4
No files found.
src/script/functions/english.cpp
View file @
4a0c76ed
...
@@ -253,7 +253,20 @@ String process_english_hints(const String& str) {
...
@@ -253,7 +253,20 @@ String process_english_hints(const String& str) {
size_t
after
=
skip_tag
(
str
,
i
);
size_t
after
=
skip_tag
(
str
,
i
);
if
(
after
!=
String
::
npos
)
{
if
(
after
!=
String
::
npos
)
{
Char
c
=
str
.
GetChar
(
after
);
Char
c
=
str
.
GetChar
(
after
);
if
(
is_vowel
(
c
)
&&
ret
.
size
()
>=
2
)
{
if
(
singplur
==
1
&&
is_substr
(
str
,
after
,
_
(
"a</param-"
)))
{
// a -> an, where the a originates from english_number_a(1)
size_t
after_end
=
skip_tag
(
str
,
after
+
1
);
if
(
after_end
==
String
::
npos
)
{
throw
Error
(
_
(
"Incomplete </param> tag"
));
}
if
(
after_end
!=
String
::
npos
&&
after_end
+
1
<
str
.
size
()
&&
isSpace
(
str
.
GetChar
(
after_end
))
&&
is_vowel
(
str
.
GetChar
(
after_end
+
1
)))
{
ret
.
append
(
str
,
i
,
after
-
i
);
ret
+=
_
(
"an"
);
i
=
after
+
1
;
continue
;
}
}
else
if
(
is_vowel
(
c
)
&&
ret
.
size
()
>=
2
)
{
// a -> an?
// a -> an?
// is there "a" before this?
// is there "a" before this?
String
last
=
ret
.
substr
(
ret
.
size
()
-
2
);
String
last
=
ret
.
substr
(
ret
.
size
()
-
2
);
...
@@ -262,13 +275,13 @@ String process_english_hints(const String& str) {
...
@@ -262,13 +275,13 @@ String process_english_hints(const String& str) {
ret
.
insert
(
ret
.
size
()
-
1
,
_
(
'n'
));
ret
.
insert
(
ret
.
size
()
-
1
,
_
(
'n'
));
}
}
}
else
if
(
is_substr
(
str
,
after
,
_
(
"</param-"
))
&&
ret
.
size
()
>=
1
&&
}
else
if
(
is_substr
(
str
,
after
,
_
(
"</param-"
))
&&
ret
.
size
()
>=
1
&&
ret
.
GetChar
(
ret
.
size
()
-
1
)
==
_
(
' '
))
{
ret
.
GetChar
(
ret
.
size
()
-
1
)
==
_
(
' '
))
{
// empty param, drop space before it
// empty param, drop space before it
ret
.
resize
(
ret
.
size
()
-
1
);
ret
.
resize
(
ret
.
size
()
-
1
);
}
}
}
}
ret
+=
c
;
ret
.
append
(
str
,
i
,
min
(
after
,
str
.
size
())
-
i
)
;
++
i
;
i
=
after
;
}
else
if
(
is_substr
(
str
,
i
,
_
(
"<singular>"
)))
{
}
else
if
(
is_substr
(
str
,
i
,
_
(
"<singular>"
)))
{
// singular -> keep, plural -> drop
// singular -> keep, plural -> drop
size_t
start
=
skip_tag
(
str
,
i
);
size_t
start
=
skip_tag
(
str
,
i
);
...
@@ -300,6 +313,10 @@ String process_english_hints(const String& str) {
...
@@ -300,6 +313,10 @@ String process_english_hints(const String& str) {
++
i
;
++
i
;
}
}
singplur
=
0
;
singplur
=
0
;
}
else
if
(
c
==
_
(
'<'
))
{
size_t
after
=
skip_tag
(
str
,
i
);
ret
.
append
(
str
,
i
,
min
(
after
,
str
.
size
())
-
i
);
i
=
after
;
}
else
{
}
else
{
ret
+=
c
;
ret
+=
c
;
++
i
;
++
i
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment