Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Porter stemmer #19

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Adding Porter stemmer #19

wants to merge 17 commits into from

Conversation

jpontoire
Copy link
Contributor

No description provided.

("relate", "relat"),
("pirate", "pirat"),
("necessitate", "necessit"),
("you", "you"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test "" et "a"

"ent", "ou", "ism", "ate", "iti", "ous", "ive", "ize"
];

fn double_consonant(word: &str, exceptions: Option<&str>) -> bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify

};
}

static STEP3: Steps<7> = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steps is not required.

static ref STEP1A1: Regex = Regex::new(r"^(.+?)(ss|i)es$").unwrap();
static ref STEP1A2: Regex = Regex::new(r"^(.+?)([^s])s$").unwrap();
static ref STEP1B1: Regex = Regex::new(r"^(.+?)eed$").unwrap();
static ref STEP1B2: Regex = Regex::new(r"(ed|ing)$").unwrap();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(?:

}

// Step 1a
if STEP1A1.find(&word).is_some() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_match

// Step 1b
if STEP1B1.find(&word).is_some() {
let stem = word[..word.len() - 1].to_string();
if compute_m(&stem) > 0{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compute_m(&word[..word.len() - 1])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.chars().last().unwrap().len()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants