Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hubot-natural
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
Container Registry
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
hubot-natural
Commits
963cb5c4
Commit
963cb5c4
authored
7 years ago
by
Felipe Duerno
Browse files
Options
Downloads
Patches
Plain Diff
fix error when trying to put folders inside the training data folder
parent
b16e3b60
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Dockerfile
+1
-0
1 addition, 0 deletions
Dockerfile
docker-compose.yml
+1
-0
1 addition, 0 deletions
docker-compose.yml
scripts/lib/common.coffee
+12
-6
12 additions, 6 deletions
scripts/lib/common.coffee
with
14 additions
and
6 deletions
Dockerfile
+
1
−
0
View file @
963cb5c4
...
...
@@ -4,6 +4,7 @@ LABEL mantainer "Diego Dorgam <diego.dorgam@rocket.chat>"
ENV
HUBOT_LANG='en' \
HUBOT_CORPUS='training_data/corpus.yml' \
HUBOT_RECURSIVE_TRAINING=false \
HUBOT_ADAPTER=rocketchat \
HUBOT_OWNER=RocketChat \
HUBOT_NAME=HubotNatural \
...
...
This diff is collapsed.
Click to expand it.
docker-compose.yml
+
1
−
0
View file @
963cb5c4
...
...
@@ -51,6 +51,7 @@ services:
-
HUBOT_DESCRIPTION='Hubot natural language processing'
-
HUBOT_LOG_LEVEL=debug
-
HUBOT_CORPUS=training_data/corpus.yml
-
HUBOT_RECURSIVE_TRAINING=false
-
HUBOT_LANG=pt
-
RESPOND_TO_DM=true
-
RESPOND_TO_LIVECHAT=true
...
...
This diff is collapsed.
Click to expand it.
scripts/lib/common.coffee
+
12
−
6
View file @
963cb5c4
...
...
@@ -25,13 +25,18 @@ common.stringElseRandomKey = (variable) ->
if
variable
instanceof
Array
variable
[
Math
.
floor
(
Math
.
random
()
*
variable
.
length
)]
getYAMLFiles
=
(
filepath
)
->
getYAMLFiles
=
(
filepath
,
recursive
=
false
)
->
listFile
=
fs
.
readdirSync
filepath
dataFiles
=
[]
if
listFile
.
length
>
0
dataFiles
=
listFile
.
map
(
filename
)
->
return
yaml
.
safeLoad
fs
.
readFileSync
filepath
+
'/'
+
filename
,
'utf8'
else
for
filename
in
listFile
file
=
filepath
+
'/'
+
filename
if
fs
.
lstatSync
(
file
).
isFile
()
dataFiles
.
push
(
yaml
.
safeLoad
fs
.
readFileSync
file
,
'utf8'
)
else
if
recursive
dataFiles
=
dataFiles
.
concat
(
getYAMLFiles
file
,
recursive
)
if
dataFiles
.
lenght
is
0
console
.
error
(
'The directory: '
+
filepath
+
' is empty.'
)
return
dataFiles
...
...
@@ -61,7 +66,8 @@ common.loadConfigfile = (filepath) ->
return
yaml
.
safeLoad
fs
.
readFileSync
filepath
,
'utf8'
else
if
fs
.
lstatSync
(
filepath
).
isDirectory
()
yamlFiles
=
getYAMLFiles
(
filepath
)
recursiveTraining
=
process
.
env
.
HUBOT_RECURSIVE_TRAINING
||
false
yamlFiles
=
getYAMLFiles
(
filepath
,
recursiveTraining
)
return
concatYAMLFiles
(
yamlFiles
)
catch
err
...
...
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