Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from amos-ws16/dev
Sprint 05 Release
- Loading branch information
Showing
17 changed files
with
220 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/bin/bash | ||
mkdir deployment-build | ||
mkdir deployment-build/temp | ||
mkdir -p deployment-build/temp | ||
cp -R $(git ls-tree --name-only HEAD) deployment-scripts/config.cfg appspec.yml deployment-build/temp/ | ||
cd deployment-build/temp | ||
zip -r ../latest.zip ./ | ||
cd ../.. | ||
rm -R deployment-build/temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# REST API Reference | ||
This file documents the REST API input and output schemata for the route | ||
`/api/score`. | ||
|
||
## Input Schema | ||
All fields are optional unless specified as required. | ||
|
||
```json | ||
{ | ||
"file": { | ||
"name": "(required) string ", | ||
"filetype": "(required) string png/jpeg", | ||
"timestamp": "(required) number", | ||
"user": "(required) id string", | ||
"description": "string that was sent with the upload", | ||
"context": { | ||
"chat": "...", | ||
"more stuff": "...", | ||
"to be defined later": "..." | ||
} | ||
}, | ||
"tasks": [ | ||
{ | ||
"name": "(required) string", | ||
"timestamp": "(required) number", | ||
"due_date": "number", | ||
"user": "(required) id string", | ||
"assignees": ["userid1", "userid2", "..."], | ||
"description": "string", | ||
"location": "..." | ||
}, | ||
"..."] | ||
} | ||
``` | ||
|
||
## Output Schema | ||
Not yet finished. | ||
|
||
```json | ||
{ | ||
"tasks": [ | ||
{ | ||
"name": "string", | ||
"score": 1.0, | ||
"subscores": { | ||
"plugin-a": 1.0, | ||
"...": "..." | ||
} | ||
}, | ||
"..." | ||
] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Start the API on local or external server | ||
|
||
|
||
1. Open the command line | ||
2. Go to the main directory of the project | ||
3. Type 'npm start' to start the API on standard port 3000 | ||
4. To configure the port type 'npm start -- your_port' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const stringSimilarity = require('string-similarity') | ||
const keywordExtractor = require('keyword-extractor') | ||
const utils = require('../utils.js') | ||
|
||
/** | ||
* First uses the keyword-extractor to get the keywords, then compares the keywords with stringSimilarity to get a context score | ||
* | ||
* @param file - the file with its description | ||
* @param task - the task with its description | ||
*/ | ||
function similarContextPlugin (sString1, sString2) { | ||
utils.isString(sString1) | ||
utils.isString(sString2) | ||
const sKeywords1 = getKeywords(sString1) | ||
const sKeywords2 = getKeywords(sString2) | ||
|
||
return stringSimilarity.compareTwoStrings(sKeywords1, sKeywords2) | ||
} | ||
|
||
/** | ||
* Uses the keyword-extractor module to get the keywords from the description and then joins the array to a string | ||
* | ||
* @param description - as string | ||
*/ | ||
function getKeywords (description) { | ||
return keywordExtractor.extract(description, { | ||
language: 'english', | ||
remove_digits: true, | ||
return_changed_case: true, | ||
remove_duplicates: false | ||
}).join(' ') | ||
} | ||
|
||
module.exports = similarContextPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const buster = require('buster') | ||
const plugin = require('../../lib/plugins/similar-context-plugin.js') | ||
|
||
buster.testCase('similar-context-plugin', { | ||
'should return 1.0 when the keywords of file description and task description match exactly': function () { | ||
let sString1 = 'president obama woke monday facing congressional defeat parties believed hobble presidency' | ||
let sString2 = 'President Obama woke up Monday facing a Congressional defeat that many in both parties believed could hobble his presidency.' | ||
let result = plugin(sString1, sString2) | ||
buster.assert.near(1.0, result, 0) | ||
}, | ||
|
||
'should return 0.0 when the keywords of file description and task description dont match at all': function () { | ||
let sString1 = '123 3415i 02387564' | ||
let sString2 = 'President Obama woke up Monday facing a Congressional defeat that many in both parties believed could hobble his presidency.' | ||
let result = plugin(sString1, sString2) | ||
buster.assert.near(0.0, result, 0) | ||
}, | ||
|
||
'should throw an error if called with a non-string parameter': function () { | ||
let iNumber = 12 | ||
let sString = 'President Obama woke up Monday facing a Congressional defeat that many in both parties believed could hobble his presidency.' | ||
buster.assert.exception(() => plugin(iNumber, sString)) | ||
} | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters