Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eecs398-search
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vcday
eecs398-search
Commits
b9a95bef
Commit
b9a95bef
authored
7 years ago
by
vcday
Browse files
Options
Downloads
Patches
Plain Diff
fixed stemmer
parent
d69dc520
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
parser/Parser.cpp
+0
-1
0 additions, 1 deletion
parser/Parser.cpp
parser/tests/parserTest.cpp
+21
-25
21 additions, 25 deletions
parser/tests/parserTest.cpp
util/Stemmer.cpp
+1
-1
1 addition, 1 deletion
util/Stemmer.cpp
util/tests/tokenizerTest.cpp
+1
-0
1 addition, 0 deletions
util/tests/tokenizerTest.cpp
with
23 additions
and
27 deletions
parser/Parser.cpp
+
0
−
1
View file @
b9a95bef
...
@@ -49,7 +49,6 @@ void Parser::parse ( string html, Tokenizer *tokenizer )
...
@@ -49,7 +49,6 @@ void Parser::parse ( string html, Tokenizer *tokenizer )
if
(
url
!=
""
)
if
(
url
!=
""
)
{
{
urlFrontier
->
Push
(
url
);
urlFrontier
->
Push
(
url
);
cout
<<
url
<<
endl
;
}
}
// check if line is title
// check if line is title
else
else
...
...
This diff is collapsed.
Click to expand it.
parser/tests/parserTest.cpp
+
21
−
25
View file @
b9a95bef
...
@@ -12,34 +12,14 @@ void testSimple ( );
...
@@ -12,34 +12,14 @@ void testSimple ( );
void
testComplex
(
);
void
testComplex
(
);
void
testURL
(
);
int
main
(
)
int
main
(
)
{
{
cout
<<
"Testing Parser ... "
<<
endl
<<
endl
;
cout
<<
"Testing Parser ... "
<<
endl
<<
endl
;
testURL
(
);
const
char
*
line
=
"<li><span class=
\"
official-website
\"
><span class=
\"
url
\"
><a rel=
\"
nofollow
\"
class=
\"
external text
\"
href=
\"
http://www.bafta.org/
\"
>Official website</a></span></span></li>"
;
testSimple
(
);
testComplex
(
);
ProducerConsumerQueue
<
string
>
urlFrontierTest
;
ParsedUrl
url
=
ParsedUrl
(
"testurl.com"
);
char
docString
[
10240
];
strcpy
(
docString
,
line
);
Document
document
(
url
,
docString
);
Parser
parser
(
&
urlFrontierTest
);
auto
dict
=
parser
.
execute
(
&
document
);
for
(
auto
it
=
dict
->
begin
(
);
it
!=
dict
->
end
(
);
it
++
)
{
cout
<<
it
->
first
<<
':'
;
for
(
int
i
=
0
;
i
<
it
->
second
.
size
(
);
++
i
)
{
cout
<<
it
->
second
[
i
]
<<
" "
;
}
cout
<<
std
::
endl
;
}
// testSimple( );
// testComplex( );
cout
<<
"Parser Tests Passed! :D"
<<
endl
;
cout
<<
"Parser Tests Passed! :D"
<<
endl
;
}
}
...
@@ -48,7 +28,7 @@ void testSimple ( )
...
@@ -48,7 +28,7 @@ void testSimple ( )
{
{
ProducerConsumerQueue
<
string
>
urlFrontierTest
;
ProducerConsumerQueue
<
string
>
urlFrontierTest
;
ParsedUrl
url
=
ParsedUrl
(
"testurl.com"
);
ParsedUrl
url
=
ParsedUrl
(
"
http://www.
testurl.com"
);
char
docString
[
10240
];
char
docString
[
10240
];
strcpy
(
docString
,
"<title>This Cat Title Cat</title>"
);
strcpy
(
docString
,
"<title>This Cat Title Cat</title>"
);
Document
document
(
url
,
docString
);
Document
document
(
url
,
docString
);
...
@@ -105,3 +85,19 @@ void testComplex ( )
...
@@ -105,3 +85,19 @@ void testComplex ( )
delete
[]
writable
;
delete
[]
writable
;
}
}
void
testURL
(
)
{
const
char
*
line
=
"<li><span class=
\"
official-website
\"
><span class=
\"
url
\"
><a rel=
\"
nofollow
\"
class=
\"
external text
\"
href=
\"
http://www.bafta.org/
\"
>Official website</a></span></span></li>"
;
ProducerConsumerQueue
<
string
>
urlFrontierTest
;
ParsedUrl
url
=
ParsedUrl
(
"testurl.com"
);
char
docString
[
10240
];
strcpy
(
docString
,
line
);
Document
document
(
url
,
docString
);
Parser
parser
(
&
urlFrontierTest
);
auto
dict
=
parser
.
execute
(
&
document
);
assert
(
urlFrontierTest
.
Pop
(
)
==
"http://www.bafta.org/"
);
delete
dict
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
util/Stemmer.cpp
+
1
−
1
View file @
b9a95bef
...
@@ -323,7 +323,7 @@ std::string Stemmer::step1b ( std::string word )
...
@@ -323,7 +323,7 @@ std::string Stemmer::step1b ( std::string word )
else
if
(
*
substrING
!=
'\0'
&&
isVowelPresent
(
word
.
begin
(
),
substrING
,
word
)
)
else
if
(
*
substrING
!=
'\0'
&&
isVowelPresent
(
word
.
begin
(
),
substrING
,
word
)
)
{
{
wordStem
=
subStr
(
word
.
begin
(
),
substrING
);
wordStem
=
subStr
(
word
.
begin
(
),
substrING
);
if
(
addE
(
wordStem
)
||
(
m
==
1
&&
endCVC
(
wordStem
+
'e'
)
)
)
if
(
addE
(
wordStem
)
||
(
m
easure
(
wordStem
)
==
1
&&
endCVC
(
wordStem
+
'e'
)
)
)
{
{
wordStem
+=
'e'
;
wordStem
+=
'e'
;
}
}
...
...
This diff is collapsed.
Click to expand it.
util/tests/tokenizerTest.cpp
+
1
−
0
View file @
b9a95bef
...
@@ -41,5 +41,6 @@ void testExecute ( string original )
...
@@ -41,5 +41,6 @@ void testExecute ( string original )
}
}
cout
<<
std
::
endl
;
cout
<<
std
::
endl
;
}
}
delete
dict
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment