From 9dd2a31b72e5e527e2dae3b68f856ab8da879e93 Mon Sep 17 00:00:00 2001
From: ab <abdullah_ahmed@brown.edu>
Date: Mon, 12 Aug 2019 16:41:23 -0400
Subject: documentation

---
 src/client/ClientRecommender.tsx | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

(limited to 'src/client/ClientRecommender.tsx')

diff --git a/src/client/ClientRecommender.tsx b/src/client/ClientRecommender.tsx
index ddaa8a7fc..63f85c737 100644
--- a/src/client/ClientRecommender.tsx
+++ b/src/client/ClientRecommender.tsx
@@ -75,13 +75,15 @@ export class ClientRecommender extends React.Component<RecommenderProps> {
         const n = 200;
         const num_words = paragraph.size;
         let meanVector = new Array<number>(n).fill(0); // mean vector
-        paragraph.forEach((wordvec: number[]) => {
-            for (let i = 0; i < n; i++) {
-                meanVector[i] += wordvec[i];
-            }
-        });
-        meanVector = meanVector.map(x => x / num_words);
-        this.addToDocSet(meanVector);
+        if (num_words > 0) { // check to see if paragraph actually was vectorized
+            paragraph.forEach((wordvec: number[]) => {
+                for (let i = 0; i < n; i++) {
+                    meanVector[i] += wordvec[i];
+                }
+            });
+            meanVector = meanVector.map(x => x / num_words);
+            this.addToDocSet(meanVector);
+        }
         return meanVector;
     }
 
@@ -106,7 +108,7 @@ export class ClientRecommender extends React.Component<RecommenderProps> {
             });
             return keyterms;
         };
-        await CognitiveServices.Text.Manager.analyzer(extDoc, ["key words"], data, converter);
+        await CognitiveServices.Text.Appliers.analyzer(extDoc, ["key words"], data, converter);
     }
 
     /***
-- 
cgit v1.2.3-70-g09d2

