# Extracting text into columns

I have a set of customer reports, each is in ms word file. they are all in a similar pattern, for example they start with Name: --, Age: --, Date: --, etc...

is there a way to extract particular strings from each file to form a data set.

In orange, I was able to compile the word documents into corpus which I can display as one column (each report is in one cell). Does orange have a way to extract strings into columns (for example if between "age:" and "gender")?

• I don't know Orange but this can be done easily with a bit of programming. You might be able to do it just with a simple 'grep' tool using regular expressions. Jun 13 '20 at 13:58
• thanks for the reply. can you please suggest a simple tutorial/video that goes through the steps? I am actually an R user not python. The only reason I switched to orange/python now is that I was told it handles text much better. Jun 15 '20 at 3:45
• there are many ways to use regular expressions with R, but it requires a bit of programming. stringr is a good library. Jun 15 '20 at 13:24

Maybe you could use Orange3-Text add-on, widget Preprocess Text, Tokenization > Regexp. The source code indicates it's a Python regex, so you might be able to use a regular expression pattern such as:

(?ix)        # ignore case, ignore comments and whitespace in this RE
(?<=age:\s)  # preceded by 'age: '
.+           # characters you wish to match
(?=gender:)  # followed by 'gender:'

• thank you. this a great idea. orange is a GUI for python and actually there is a widget to add and run a python code, so I think I will try your method. there are plenty of online tutorials on text mining that I found, is there a particular one you recommend for beginners? Jun 15 '20 at 3:47
• For beginners, all of them. Jun 15 '20 at 10:05