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")?

  • 1
    $\begingroup$ 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. $\endgroup$ – Erwan Jun 13 at 13:58
  • $\begingroup$ 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. $\endgroup$ – Bahi8482 Jun 15 at 3:45
  • $\begingroup$ there are many ways to use regular expressions with R, but it requires a bit of programming. stringr is a good library. $\endgroup$ – Erwan Jun 15 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:'
| improve this answer | |
  • $\begingroup$ 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? $\endgroup$ – Bahi8482 Jun 15 at 3:47
  • $\begingroup$ For beginners, all of them. $\endgroup$ – K3---rnc Jun 15 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.