Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-155
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-155
2021-155
Commits
fbd26b5d
Commit
fbd26b5d
authored
Aug 21, 2021
by
dasunx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Github search filenaming issues configured
parent
17231558
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
9 deletions
+44
-9
backend/controllers/questions.js
backend/controllers/questions.js
+3
-3
backend/python/auto-answer/Keyword.py
backend/python/auto-answer/Keyword.py
+34
-0
backend/python/auto-answer/github.py
backend/python/auto-answer/github.py
+3
-2
backend/python/auto-answer/scrapper.py
backend/python/auto-answer/scrapper.py
+4
-4
No files found.
backend/controllers/questions.js
View file @
fbd26b5d
...
...
@@ -34,7 +34,7 @@ exports.createQuestion = async (req, res, next) => {
text
});
res
.
status
(
201
).
json
(
question
);
const
autoAnswer
=
await
AutomatedAnswer
.
create
({
question
:
question
.
_id
});
const
autoAnswer
=
await
AutomatedAnswer
.
create
({
question
:
question
.
_id
,
loading
:
true
});
const
pythonScript
=
spawn
(
'
python
'
,
[
path
.
join
(
__dirname
,
'
..
'
,
'
python
'
,
'
auto-answer
'
,
'
scrapper.py
'
),
title
,
...
...
@@ -44,8 +44,8 @@ exports.createQuestion = async (req, res, next) => {
pythonScript
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
'
DATA FROM PYTHON IS HERE
'
+
data
);
});
pythonScript
.
std
out
.
on
(
'
end
'
,
function
()
{
console
.
log
(
'
PYTHON SCRIPT
HAS BEEN ENDED
'
);
pythonScript
.
std
err
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
'
PYTHON SCRIPT
ERROR :
'
+
data
);
});
}
catch
(
error
)
{
next
(
error
);
...
...
backend/python/auto-answer/Keyword.py
0 → 100644
View file @
fbd26b5d
import
spacy
from
collections
import
Counter
from
string
import
punctuation
class
keywords
:
"""
A class to extract technical related keywords from a text
"""
def
__init__
(
self
,
text
):
"""
Initialize a keyword object
"""
self
.
text
=
text
self
.
spacy_nlp
=
spacy
.
load
(
"en_core_web_lg"
)
def
extract
(
self
):
"""
Extract keywords from the text
"""
result
=
[]
pos_tag
=
[
"PROPN"
,
"ADJ"
,
"NOUN"
]
doc
=
self
.
spacy_nlp
(
self
.
text
.
lower
())
for
token
in
doc
:
if
(
token
.
text
in
self
.
spacy_nlp
.
Defaults
.
stop_words
or
token
.
text
in
punctuation
):
continue
if
token
.
pos_
in
pos_tag
:
result
.
append
(
token
.
text
)
return
result
backend/python/auto-answer/github.py
View file @
fbd26b5d
...
...
@@ -3,15 +3,16 @@ from search_engine_parser import GoogleSearch
import
re
class
Github
:
class
Github
Data
:
"""
A class to manage the Github API.
"""
def
__init__
(
self
):
def
__init__
(
self
,
title
):
"""
Initialize the Github API.
"""
print
(
title
)
def
get_github_resources
(
self
,
query
):
"""
...
...
backend/python/auto-answer/scrapper.py
View file @
fbd26b5d
...
...
@@ -2,7 +2,7 @@ from youtube import Youtube
from
Medium
import
Medium
from
Dev
import
DevTo
from
stof
import
STOF
from
Github
import
Github
from
github
import
GithubData
import
sys
from
database
import
get_database
...
...
@@ -17,7 +17,7 @@ def saveAnswer(ans_id, stackoverflow, videos, medium_r, dev_r, github_r):
{
"_id"
:
ObjectId
(
ans_id
)},
{
"$set"
:
{
"loading"
:
False
,
"loading"
:
False
,
"youtube"
:
videos
,
"stackoverflow"
:
stackoverflow
,
"medium_articles"
:
medium_r
.
get
(
"blogs"
,
[]),
...
...
@@ -48,7 +48,7 @@ def saveAnswer(ans_id, stackoverflow, videos, medium_r, dev_r, github_r):
if
__name__
==
"__main__"
:
# title = input("Enter question title: ")
title
=
sys
.
argv
[
1
]
title
=
sys
.
argv
[
1
]
# "what are the benefits of using java for mobile app development over flutter"
tags
=
sys
.
argv
[
2
]
# ["flutter","java"]
AUTO_ANS_ID
=
sys
.
argv
[
3
]
# "611feaff2c4db730e56d78e8"
...
...
@@ -57,7 +57,7 @@ if __name__ == "__main__":
medium
=
Medium
(
title
,
tags
)
devto
=
DevTo
(
title
,
tags
)
youtube
=
Youtube
(
title
,
tags
)
github
=
Github
(
)
github
=
Github
Data
(
title
)
ans
=
stack
.
searchQuestion
()
medium_articels
=
medium
.
getMediumArticles
()
dev_articles
=
devto
.
get_dev_articles
()
...
...
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