Writing projects
Project steps:
Initial:
Writing components
Writing graphs
Testing
Finishing up
Idea
Make a project that calculates how Canadian a string is. As an added bonus, it will determine the emotion of the string based on how eh's are used.
Requirements
Use:
- our own components
- other peoples components (other noflo libraries components)
- can use fbp
- graphs
- subgraphs
- tests (use fbp-spec and mocha tests to show both options)
- debugging
Planning
- To determine how Canadian something is, we want to check words inside of the string.
- ~ If it is easily possible, figure out how far words are from each other
- ~ and their location inside of the string (ie, at the very end, beginning, near the end.)
- Check spelling of words, Canadan vs elsewhere. Canadian spelling first, then UK, then American.
- Check the emotion of the word eh using symbols and letter case (ie, eh, Eh, EH, EH?, eh?!)
- The output should have the Emotion, and the Canadian Score.
Researching
Word Weight
Search Google for a library that may be able to help us with dealing with word weights, singularize, and pluralize words. js library determine weight of words NaturalNode looks promising
Spelling
Search Google for the spelling differences Canadian vs uk vs usa spelling
Canadian, British and American Spelling Perfect!
This is data on a table though with no apparent api, so we should get it into usable data (json). - get table as json - table to json - table to json jquery
Pseudo code
[How Canadian]
INPUT=CONTENT(string)
INPUT=WORDS(array) # words to use as weights
INPUT=SPELLING(array)
OUTPUT=EMOTION(string)
OUTPUT=SCORE(number)
# if we wanted to swap out emotion to calculate emoji insteadof _eh_ for example,
# we can easily just replace this box. the same goes for any noflo box.
[Emotion]
INPUT=CONTENT(string)
OUTPUT=EMOTION(string)
[Find Ehs]
# if it has no _eh_, emotion is flat
# could also separate to collect and doing each and then sending another stream
# and putting those back together as a score and using add
# collects stream, determines emotion of each
[Determine Emotion]
[WordScore]
OUTPUT=SCORE(number)
INPUT=LIST(array) # control port, because we want to use one for each input
INPUT=CONTENT(STRING)
# since these both calculate score, one positive, one negative,
# they can be separate instances of the same component
[CanadianScore] # LIST would use WORDS
[SpellingScore] # LIST would use SPELLING
# output of CanadianScore & SpellingScore should be added together to get result
# score from here is the SCORE
[noflo/Math/Add]
File Structure
/Components Components that you make in your editor, or make in flowhub and sync.
/Graphs Graphs that are made in
fbp
are here, as are json graphs converted from fbp and json graphs made, modified, and synchronized in flowhub-
- fbpspec this file runs all the yml tests
- runner.html this is what to run in the browser
- mocha tests any normal mocha tests
index.coffee - a file that might run your program by loading a graph and send data to it.