Python Forum
Python for syntax conversion
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python for syntax conversion
#8
(Dec-21-2019, 05:16 PM)Gribouillis Wrote: If you don't mind using someone else's code, there is a module in pypi named 'text2digits' under the MIT licence that does the number conversion
>>> from text2digits import text2digits
>>> td2 = text2digits.Text2Digits()
>>> td2.convert("I'm twenty five years old")
"I'm 25 years old"
>>> td2.convert("seventy two")
'72'
Considering that you are a beginner in python, it would probably be a good idea to use this code instead of rewriting your own. You will probably meet many other issues before the project is complete.

This is a fantastic module. The problem of last statement has been solved.
Then, I would like to use real syntax file in Etabs for conversion.
However, there is a new problem Confused
In my example, I know that there are 3 sentences and the position of the keywords so that I can extract the word and convert it.
The code I have used on the above is that I already know the file just had 3 statements so I append them into a list and assign a name for them.
But in Etabs, for example the storey statement, I don't know how many storeys are in the model previously so I can't use the code on the above.
So, how can I ensure that all the statements are extracted from the file?
Reply


Messages In This Thread
Python for syntax conversion - by kingsman - Dec-20-2019, 02:52 PM
RE: Python for syntax conversion - by ichabod801 - Dec-20-2019, 03:58 PM
RE: Python for syntax conversion - by kingsman - Dec-20-2019, 05:33 PM
RE: Python for syntax conversion - by Gribouillis - Dec-20-2019, 06:59 PM
RE: Python for syntax conversion - by kingsman - Dec-21-2019, 04:49 PM
RE: Python for syntax conversion - by Gribouillis - Dec-21-2019, 05:16 PM
RE: Python for syntax conversion - by kingsman - Dec-22-2019, 10:02 AM
RE: Python for syntax conversion - by buran - Dec-21-2019, 05:47 PM
RE: Python for syntax conversion - by Gribouillis - Dec-22-2019, 10:58 AM
RE: Python for syntax conversion - by kingsman - Dec-23-2019, 04:44 PM
RE: Python for syntax conversion - by Gribouillis - Dec-23-2019, 05:13 PM
RE: Python for syntax conversion - by kingsman - Dec-24-2019, 11:55 AM
RE: Python for syntax conversion - by Gribouillis - Dec-24-2019, 01:03 PM
RE: Python for syntax conversion - by kingsman - Dec-26-2019, 12:48 PM
RE: Python for syntax conversion - by Gribouillis - Dec-26-2019, 05:50 PM
RE: Python for syntax conversion - by kingsman - Dec-27-2019, 01:07 PM
RE: Python for syntax conversion - by Gribouillis - Dec-27-2019, 01:47 PM
RE: Python for syntax conversion - by kingsman - Dec-27-2019, 02:05 PM
RE: Python for syntax conversion - by Gribouillis - Dec-27-2019, 02:15 PM
RE: Python for syntax conversion - by kingsman - Dec-27-2019, 03:49 PM
RE: Python for syntax conversion - by kingsman - Apr-27-2020, 09:26 AM
RE: Python for syntax conversion - by Gribouillis - Dec-27-2019, 04:18 PM
RE: Python for syntax conversion - by kingsman - Dec-27-2019, 04:26 PM
RE: Python for syntax conversion - by kingsman - Apr-27-2020, 03:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python format conversion bluefrog 2 2,790 Jul-22-2018, 03:49 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020