Skip to main content
Question

string case change and search

  • November 22, 2016
  • 10 replies
  • 76 views

gis2020
Contributor
Forum|alt.badge.img+5

Hi All,

I am working on data/ names wherein I am changing the case of each word to title case using the string case changer. But there are few cases/ articles like le,la,d', with accents which i dont want to change it to the tile case if they are present in between. eg :le rocher hôtel - le restaurant' in this i want to change everythng to title case except "-le" which is in between.I want first "le" to be in tile case. correct name should be like this Le Rocher Hôtel - le Restaurant. I am using string searcher to identify these articles but its not giving me correct result.

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

10 replies

david_r
Celebrity
  • November 22, 2016

Sounds like a job for Python, this one.


takashi
Celebrity
  • November 22, 2016

Hi @dandekarpriya, if the rule is "any character that follows to a hyphen + a space should not be changed to upper case", this might work.

  1. StringReplacer 1: Replace every "-<space>" with "-X".
  2. StringCaseChanger: Change case with "Full Title Case".
  3. StringReplacer 2: Replace every "-X" with "-<space>".

gis2020
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • November 22, 2016

Hi @dandekarpriya, if the rule is "any character that follows to a hyphen + a space should not be changed to upper case", this might work.

  1. StringReplacer 1: Replace every "-<space>" with "-X".
  2. StringCaseChanger: Change case with "Full Title Case".
  3. StringReplacer 2: Replace every "-X" with "-<space>".

 

but some times i have cases without hyphen.

 

Eg Canal De Mozambique. in this i dont want to change my "de"to "De"

takashi
Celebrity
  • November 22, 2016

 

but some times i have cases without hyphen.

 

Eg Canal De Mozambique. in this i dont want to change my "de"to "De"
"de" always should be lowercase? Or is there any rule to determine which should be used - lowercase or uppercase?

 


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • November 22, 2016

possibly identifying all the words and changing them back after the case change can be an option that you should consider.

That depends naturally on the number of words that need to change back.


gis2020
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • November 22, 2016

Hi @dandekarpriya, if the rule is "any character that follows to a hyphen + a space should not be changed to upper case", this might work.

  1. StringReplacer 1: Replace every "-<space>" with "-X".
  2. StringCaseChanger: Change case with "Full Title Case".
  3. StringReplacer 2: Replace every "-X" with "-<space>".
If it is present at the beginning of the name then it needs to be change to title case. . Eg de canal mozambique so this can be change to De Canal Mozambique. But in other case where it is present in between like this "Canal De Mozambique" i want to change it to Canal de Mozambique

 

 


takashi
Celebrity
  • November 22, 2016
If it is present at the beginning of the name then it needs to be change to title case. . Eg de canal mozambique so this can be change to De Canal Mozambique. But in other case where it is present in between like this "Canal De Mozambique" i want to change it to Canal de Mozambique

 

 

Maybe you can add another pair of StringReplacers to resolve that. e.g.

 

  1. Replace "<space>de<space>" with "<space>Xde<space>" before case changing.
  2. Replace "<space>Xde<space>" with "<space>de<space>"after case changing.
However, if there were more exceptional cases other than "-<space><any>" and "<space>de<space>", scripting could also be an option as @david_r mentioned at first.

 


takashi
Celebrity
  • November 22, 2016
If it is present at the beginning of the name then it needs to be change to title case. . Eg de canal mozambique so this can be change to De Canal Mozambique. But in other case where it is present in between like this "Canal De Mozambique" i want to change it to Canal de Mozambique

 

 

This may be a more flexible solution.

 

1. StringReplacer before StringCaseChanger

 

  • Text to Match: \\s(le\\s|la\\s|de\\s|d')
  • Replacement Text: <space>X\\1
  • Use Regular Expressions: yes
2. StringReplacer after StringCaseChanger

 

  • Text to Match: \\sX(le\\s|la\\s|de\\s|d')
  • Replacement Text: <space>\\1
  • Use Regular Expressions: yes

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • December 1, 2016

lol, just link the French dictionary to your works space using a featuremerger in French locale..

( Un Mergeur de Feature)


Forum|alt.badge.img
  • December 1, 2016

Hi @dandekarpriya,

I agree with @takashi and @itay (and really love @gio's suggestion :)) I would try using StringCaseChanger and then replace

  • all <space>Le<space> with <space>le<space>
  • all <space>La<space> with <space>la<space>
  • all <space>D' with <space>d'

As there are not that many options, they can be easily dealt with one by one.

De Canal Mozambique is a more complicated case though... Unless you have a 'dictionary of names' I don't think you will be able to process all the names correctly without doing some manual validation.