0 votes

Our subtitles in both translations are in Title Case, with all words having the first letter capitalized (no minor, uncapitalized words). In the process of using FLExTrans, sometimes there are phrases (e.g. for key terms) where only the first word in the phrase outputs as capitalized. Additionally, sometimes a demonstrative that is a suffix in the source language is actually a separate word in the target language and outputs as lowercase. The following example shows both issues:

\s1 Haruanga Babuna Mana Sipsipka Hanggalang   >   \s1 Pasilanga babuna Mana Sipsip xa Panggalang

Is there a way in the text out rules to clean this up? Is there a regular expression someone has that works in the text out rules for this?

FLExTrans by (122 points)
reshown by [Administrator]

1 Answer

0 votes

I see what is going on. Your lexical entry is haruanga babuna which is mapped to pasilanga babuna. The capitalization of the first word gets retained but not the second. FLExTrans' transfer engine can't handle this so you will have to do a post-synthesis change.

In the case of Sipsipka going to Sipsip xa, since this gets produced by a rule you could wrap the literal string you are outputting with the 'get-case-from' element. It would look like this:

This means if the original word coming in is uppercase, the xa will come out in uppercase. Likewise if it is lowercase, it will come out in lowercase.

But, you may have other words in a section title that are coming out lowercase for various reasons. So you may want a general solution to make all the words title case.

There isn't a one-line regular expression that would do this. So I see two possible solutions:

1) Add a custom module to your Drafting set of modules that would run some Python code to capitalize all words in a section header.

2) Add a regular expression for each letter of the alphabet. This is not so nice to have 26 expressions in your Text Out rules, but it works.

The expression for 'a' would be Search For: (^\\s.*?\b)a(\w*) Replace with: \1A\2

To make it easy to add all these, you can add the following xml lines below <SearchReplaceRules> in the file Output\fixup_synthesis_rules.xml:

 <SearchReplaceRule RegEx="yes" Inactive="no" Comment="">

   <SearchString>(^\\s.*?\b)a(\w*)</SearchString>

   <ReplaceString>\1A\2</ReplaceString>

 </SearchReplaceRule>

 <SearchReplaceRule RegEx="yes" Inactive="no" Comment="">

   <SearchString>(^\\s.*?\b)b(\w*)</SearchString>

   <ReplaceString>\1B\2</ReplaceString>

 </SearchReplaceRule>

 <SearchReplaceRule RegEx="yes" Inactive="no" Comment="">

   <SearchString>(^\\s.*?\b)c(\w*)</SearchString>

   <ReplaceString>\1C\2</ReplaceString>

 </SearchReplaceRule>

 <SearchReplaceRule RegEx="yes" Inactive="no" Comment="">

   <SearchString>(^\\s.*?\b)d(\w*)</SearchString>

   <ReplaceString>\1D\2</ReplaceString>

 </SearchReplaceRule>

 <SearchReplaceRule RegEx="yes" Inactive="no" Comment="">

   <SearchString>(^\\s.*?\b)e(\w*)</SearchString>

   <ReplaceString>\1E\2</ReplaceString>

 </SearchReplaceRule>

 <SearchReplaceRule RegEx="yes" Inactive="no" Comment="">

   <SearchString>(^\\s.*?\b)f(\w*)</SearchString>

   <ReplaceString>\1F\2</ReplaceString>

 </SearchReplaceRule>

 <SearchReplaceRule RegEx="yes" Inactive="no" Comment="">

   <SearchString>(^\\s.*?\b)g(\w*)</SearchString>

   <ReplaceString>\1G\2</ReplaceString>

 </SearchReplaceRule>

etc.

by (336 points)

An improved Regex is:

(^\\s[^\\]*?\b)r(.+?)(?=\\)

the replacement can remain:

\1R\2

The improvement stops making capitalization changes when it gets to the next backslash (\) which is important. 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
And over all these virtues put on love, which binds them all together in perfect unity.
Colossians 3:14
3,034 questions
5,988 answers
5,659 comments
2,020 users