Closed The-Gupta closed 6 years ago
SOLUTION: Replaced nodeOne and nodeTwo by nodeOnes and nodeTwos respecively and it worked. Weird bug!
> var peopleData = [
... ['ReqID2', 'Req', 'finalSimilarityScore', 'color', 'nodeOnes:ReqKeyword', 'nodeOnes:nodeTwos:TCID2', 'nodeOnes:nodeTwos:TCKeyword', 'nodeOnes:nodeTwos:score'],
... ['0001', 'Alpha', 0.47, 'Red', 'NSF', '0001', 'UYT', 0.87],
... ['0001', 'Alpha', 0.47, 'Red', 'create issue XS', '0001', 'XS', 0.0],
... ['0002', 'Beta', 0.63, 'Yellow', 'XS', '0001', 'XS', 0.0],
... ['0002', 'Beta', 0.63, 'Yellow', 'XS', '0002', 'XS', 0.0],
... ['0002', 'Beta', 0.63, 'Yellow', 'XS', '0003', 'XS', 0.0]
... ];
undefined
> var Treeize = require('D:/FROM_C_on_05-Jan-18/Desktop/experimentsOn_23-May-18/node_modules/treeize');
undefined
> var people = new Treeize();
undefined
> people.grow(peopleData);
Treeize {
baseOptions:
{ input: { delimiter: ':', detectCollections: true, uniformRows: false },
output: { prune: true, objectOverwrite: true, resultsAsObject: false },
log: false },
data:
{ signature: { nodes: [], type: 'array', isFixed: true },
seed: [ [Object], [Object], [Object], [Object], [Object] ],
tree: [ [Object], [Object] ] },
stats: { time: { total: 0, signatures: 0 }, rows: 5, sources: 1 },
_options:
{ input: { delimiter: ':', detectCollections: true, uniformRows: false },
output: { prune: true, objectOverwrite: true, resultsAsObject: false },
log: false } }
> console.log(JSON.stringify(people.getData(), null, 4));
[
{
"ReqID2": "0001",
"Req": "Alpha",
"finalSimilarityScore": 0.47,
"color": "Red",
"nodeOnes": [
{
"ReqKeyword": "NSF",
"nodeTwos": [
{
"TCID2": "0001",
"TCKeyword": "UYT",
"score": 0.87
}
]
},
{
"ReqKeyword": "create issue XS",
"nodeTwos": [
{
"TCID2": "0001",
"TCKeyword": "XS",
"score": 0
}
]
}
]
},
{
"ReqID2": "0002",
"Req": "Beta",
"finalSimilarityScore": 0.63,
"color": "Yellow",
"nodeOnes": [
{
"ReqKeyword": "XS",
"nodeTwos": [
{
"TCID2": "0001",
"TCKeyword": "XS",
"score": 0
},
{
"TCID2": "0002",
"TCKeyword": "XS",
"score": 0
},
{
"TCID2": "0003",
"TCKeyword": "XS",
"score": 0
}
]
}
]
}
]
undefined
>
I've node version 4.5. The output is not as desired, you can see. What should I change?