1
votes

I am trying to extract sentences that has citations from research articles. I have managed to extract all sentences except the one.

"Relevance (for the individual undergoing a learning process) appears as triggers in Hidi and Renninger’s model (2006) and can be any of the types of relevance in Priniski et al.’s continuum."

(r'\w.+\(\d{4}\)+\.*', regex = True) is the pattern I have used. I wonder if the words inside parenthesis are to be dealt.

Sample paragraph from the article:

n \n\nOn Work Relevance of Adult Education: A Case Study Narrative \n\nTone Vold1,2, Hanne Haave2 and Aristidis Kaloudis1 \n1NTNU, Norway \n2INN, Norway \[email protected] \[email protected] \[email protected] \[email protected] \nDOI: 10.34190/EJKM.18.02.002 \n \nAbstract: There is an increased focus on relevance of higher education. Mostly it is about enhanced job opportunities or job \nadvancements for the individual. However, relevance of higher education may also be towards solving important issues or \nproblems at a workplace. There are some necessary preconditions as to how an educational activity becomes relevant. \nFirstly, the student must be capable to discover how generic knowledge and acquired skills may or may not apply to concrete \nsituations at work. This requires experience, understanding of the norms and culture of the organisation and a certain form \nof practical intelligence.

I have split & tokenized the sentences and then converted it to a dataframe from which I am trying to match and extract entire sentences with citations using the following code

print (df[df['sentences'].str.contains((r'\w.+(\d{4})+.*', regex = True)]) is the code I use to extract all rows/sentences with citation from the dataframe (df)

I have managed to write different regex patterns that matches the entire sentence in rows of my dataframe. A regex pattern that will match my problem sentence will help me out.

1
Can you include all sentences, or at least a few more other than the one which you can't match? - Tim Biegeleisen
What do you mean by "extract"? Is the regex supposed to match the entire sentence, or exactly what? Also, please show all the relevant code, not just "the pattern I have used". - Karl Knechtel

1 Answers

0
votes

Your regex will stop after any sequence with 4 digits inside parens, in this case "(2006)", repeating 1 or more times, and then a possible period 0 or more times.

So you'll want a pattern that gets the rest of the characters after the parens and then a pattern for the period that ends the sentence, while not capturing for example the "." in "et al.'s".

I'd recommend https://regex101.com/ for testing out regex.