Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
word2vec
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
35
Issues
35
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DESHPANDE SRIJAY PARAG
word2vec
Commits
ffd46fd1
Commit
ffd46fd1
authored
Sep 08, 2014
by
tmikolov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed minor bugs
parent
891d84c6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
5 deletions
+23
-5
compute-accuracy.c
compute-accuracy.c
+7
-1
distance.c
distance.c
+7
-1
word-analogy.c
word-analogy.c
+7
-1
word2vec.c
word2vec.c
+2
-2
No files found.
compute-accuracy.c
View file @
ffd46fd1
...
...
@@ -53,7 +53,13 @@ int main(int argc, char **argv)
return
-
1
;
}
for
(
b
=
0
;
b
<
words
;
b
++
)
{
fscanf
(
f
,
"%s%c"
,
&
vocab
[
b
*
max_w
],
&
ch
);
a
=
0
;
while
(
1
)
{
vocab
[
b
*
max_w
+
a
]
=
fgetc
(
f
);
if
(
feof
(
f
)
||
(
vocab
[
b
*
max_w
+
a
]
==
' '
))
break
;
if
((
a
<
max_w
)
&&
(
vocab
[
b
*
max_w
+
a
]
!=
'\n'
))
a
++
;
}
vocab
[
b
*
max_w
+
a
]
=
0
;
for
(
a
=
0
;
a
<
max_w
;
a
++
)
vocab
[
b
*
max_w
+
a
]
=
toupper
(
vocab
[
b
*
max_w
+
a
]);
for
(
a
=
0
;
a
<
size
;
a
++
)
fread
(
&
M
[
a
+
b
*
size
],
sizeof
(
float
),
1
,
f
);
len
=
0
;
...
...
distance.c
View file @
ffd46fd1
...
...
@@ -51,7 +51,13 @@ int main(int argc, char **argv) {
return
-
1
;
}
for
(
b
=
0
;
b
<
words
;
b
++
)
{
fscanf
(
f
,
"%s%c"
,
&
vocab
[
b
*
max_w
],
&
ch
);
a
=
0
;
while
(
1
)
{
vocab
[
b
*
max_w
+
a
]
=
fgetc
(
f
);
if
(
feof
(
f
)
||
(
vocab
[
b
*
max_w
+
a
]
==
' '
))
break
;
if
((
a
<
max_w
)
&&
(
vocab
[
b
*
max_w
+
a
]
!=
'\n'
))
a
++
;
}
vocab
[
b
*
max_w
+
a
]
=
0
;
for
(
a
=
0
;
a
<
size
;
a
++
)
fread
(
&
M
[
a
+
b
*
size
],
sizeof
(
float
),
1
,
f
);
len
=
0
;
for
(
a
=
0
;
a
<
size
;
a
++
)
len
+=
M
[
a
+
b
*
size
]
*
M
[
a
+
b
*
size
];
...
...
word-analogy.c
View file @
ffd46fd1
...
...
@@ -50,7 +50,13 @@ int main(int argc, char **argv) {
return
-
1
;
}
for
(
b
=
0
;
b
<
words
;
b
++
)
{
fscanf
(
f
,
"%s%c"
,
&
vocab
[
b
*
max_w
],
&
ch
);
a
=
0
;
while
(
1
)
{
vocab
[
b
*
max_w
+
a
]
=
fgetc
(
f
);
if
(
feof
(
f
)
||
(
vocab
[
b
*
max_w
+
a
]
==
' '
))
break
;
if
((
a
<
max_w
)
&&
(
vocab
[
b
*
max_w
+
a
]
!=
'\n'
))
a
++
;
}
vocab
[
b
*
max_w
+
a
]
=
0
;
for
(
a
=
0
;
a
<
size
;
a
++
)
fread
(
&
M
[
a
+
b
*
size
],
sizeof
(
float
),
1
,
f
);
len
=
0
;
for
(
a
=
0
;
a
<
size
;
a
++
)
len
+=
M
[
a
+
b
*
size
]
*
M
[
a
+
b
*
size
];
...
...
word2vec.c
View file @
ffd46fd1
...
...
@@ -152,9 +152,9 @@ void SortVocab() {
train_words
=
0
;
for
(
a
=
0
;
a
<
size
;
a
++
)
{
// Words occuring less than min_count times will be discarded from the vocab
if
(
vocab
[
a
].
cn
<
min_count
)
{
if
(
(
vocab
[
a
].
cn
<
min_count
)
&&
(
a
!=
0
)
)
{
vocab_size
--
;
free
(
vocab
[
vocab_size
].
word
);
free
(
vocab
[
a
].
word
);
}
else
{
// Hash will be re-computed, as after the sorting it is not actual
hash
=
GetWordHash
(
vocab
[
a
].
word
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment