Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
sophia
BasicC++
Commits
4f132f06
Commit
4f132f06
authored
1 year ago
by
sophia
Browse files
Options
Downloads
Patches
Plain Diff
search
parent
9e6f87ab
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tasks/search/search.cpp
+2
-2
tasks/search/search.cpp
with
2 additions
and
2 deletions
tasks/search/search.cpp
+
2
−
2
View file @
4f132f06
...
...
@@ -94,7 +94,7 @@ std::vector<std::string_view> Search(std::string_view text, std::string_view que
for
(
size_t
line_num
=
0
;
line_num
<
all_words_of_all_lines
.
size
();
++
line_num
)
{
long
double
tf_idf_for_line
=
0
;
for
(
std
::
string_view
que
:
unique_queries
)
{
if
(
all_words_of_all_lines
[
line_num
].
empty
()
||
counts_of_texts
[
que
]
==
0
)
{
if
(
counts_of_texts
[
que
]
==
0
)
{
continue
;
}
const
long
double
tf
=
static_cast
<
long
double
>
(
counts_of_words_of_lines
[
line_num
][
que
])
/
...
...
@@ -109,7 +109,7 @@ std::vector<std::string_view> Search(std::string_view text, std::string_view que
}
std
::
sort
(
tf_idf_for_all_query
.
begin
(),
tf_idf_for_all_query
.
end
(),
[](
const
std
::
pair
<
long
double
,
std
::
string_view
>&
a
,
const
std
::
pair
<
long
double
,
std
::
string_view
>&
b
)
{
return
a
.
first
>
=
b
.
first
;
return
a
.
first
>
b
.
first
;
});
for
(
size_t
i
=
0
;
i
<
results_count
;
++
i
)
{
if
(
i
>=
tf_idf_for_all_query
.
size
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets