Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I ADD accents to a letter? [closed]

Tags:

python

I am working on a tool to do automatic Spanish verb conjugation. In one tense, the rule is to accent the last vowel.

While I can create a map to get the accented version of a letter, I was wondering if there is a clean, pythonic way to manipulate characters to add diacritical marks (I think I have the right term).

For example:

fue -> fué

presta -> prestá

etc.

like image 790
Pat Avatar asked Jan 12 '16 23:01

Pat


People also ask

How do you type ñ and í on your computer?

Windows Computer or Laptop Enable the numeric keypad by turning on the Num lock key. Hold the Alt key then type 164 on the numeric keypad to create a lowercase ñ. For the uppercase Ñ, hold the Alt key then type 165.

How do I type é on my keyboard?

Unlike iOS, Android doesn't come preloaded with support for accented characters. However, there's an app for that—several of them, actually. Simply head to your app store and search for a “smart keyboard.” Choose whichever you like best, install it, then type accents, acute or otherwise, whenever you need.


1 Answers

It depends on the encoding that you want to use. If you're using Latin encoding, then a character map is the way to go. If you're using Unicode, it could be nicer to use combining characters; the unicode character for an acute accent is '\u0301', and it comes after the letter you're applying it to:

In [40]: 'fue'+ u'\u0301'
Out[40]: 'fué'
like image 93
maxymoo Avatar answered Oct 11 '22 15:10

maxymoo