コード例 #1
0
ファイル: uclassify.py プロジェクト: Kullax/WebScience16
 def untrain(self,texts,className,classifierName):
     """Performs untraining on text for a specific class.
        :param texts: (required) A List of text used up for training.
        :param className: (required) Name of the class.
        :param classifierName: (required) Name of the Classifier
     """
     base64texts = []
     for text in texts:
         base64_text = base64.b64encode(text) #For Python version 3, need to change.
         base64texts.append(base64_text)
     doc,root_element = self._buildbasicXMLdoc()
     textstag = doc.createElement("texts")
     writecalls = doc.createElement("writeCalls")
     writecalls.setAttribute("classifierName",classifierName)
     root_element.appendChild(textstag)
     root_element.appendChild(writecalls)
     counter = 1
     for text in base64texts:
         textbase64 = doc.createElement("textBase64")
         traintag = doc.createElement("untrain")
         textbase64.setAttribute("id",className + "Text" + str(counter))
         ptext = doc.createTextNode(text)
         textbase64.appendChild(ptext)
         textstag.appendChild(textbase64)
         traintag.setAttribute("id","Untrain"+className+ str(counter))
         traintag.setAttribute("className",className)
         traintag.setAttribute("textId",className + "Text" + str(counter))
         counter = counter + 1
         writecalls.appendChild(traintag)
     success, status_code, text = self._getResponseCode(sendData(doc.toxml()))
     if success == "false":
         raise uClassifyError(text,status_code)
コード例 #2
0
ファイル: uclassify.py プロジェクト: urwithajit9/pyuClassify
 def classify(self, texts, classifierName, username=None):
     """Performs classification on texts.
        :param texts: (required) A List of texts that needs to be classified.
        :param classifierName: (required) Classifier Name
        :param username: (optional): Name of the user, under whom the classifier exists.
     """
     doc, root_element = self._buildbasicXMLdoc()
     textstag = doc.createElement("texts")
     readcalls = doc.createElement("readCalls")
     if self.readApiKey == None:
         raise uClassifyError("Read API Key not Initialized")
     readcalls.setAttribute("readApiKey", self.readApiKey)
     root_element.appendChild(textstag)
     root_element.appendChild(readcalls)
     base64texts = []
     for text in texts:
         base64_text = base64.b64encode(
             text)  #For Python version 3, need to change.
         base64texts.append(base64_text)
     counter = 1
     for text in base64texts:
         textbase64 = doc.createElement("textBase64")
         classifytag = doc.createElement("classify")
         textbase64.setAttribute("id", "Classifytext" + str(counter))
         ptext = doc.createTextNode(text)
         textbase64.appendChild(ptext)
         classifytag.setAttribute("id", "Classify" + str(counter))
         classifytag.setAttribute("classifierName", classifierName)
         classifytag.setAttribute("textId", "Classifytext" + str(counter))
         if username != None:
             classifytag.setAttribute("username", username)
         textstag.appendChild(textbase64)
         readcalls.appendChild(classifytag)
         counter = counter + 1
     r = requests.post(self.api_url, doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text, status_code)
         else:
             return self.parseClassifyResponse(r.content, texts)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #3
0
ファイル: uclassify.py プロジェクト: echwa/pyuClassify
 def classify(self,texts,classifierName,username = None):
     """Performs classification on texts.
        :param texts: (required) A List of texts that needs to be classified.
        :param classifierName: (required) Classifier Name
        :param username: (optional): Name of the user, under whom the classifier exists.
     """
     doc,root_element = self._buildbasicXMLdoc()
     textstag = doc.createElement("texts")
     readcalls = doc.createElement("readCalls")
     if self.readApiKey == None:
         raise uClassifyError("Read API Key not Initialized")
     readcalls.setAttribute("readApiKey",self.readApiKey)
     root_element.appendChild(textstag)
     root_element.appendChild(readcalls)
     base64texts = []
     for text in texts:
         base64_text = base64.b64encode(text) #For Python version 3, need to change.
         base64texts.append(base64_text)
     counter = 1
     for text in base64texts:
         textbase64 = doc.createElement("textBase64")
         classifytag = doc.createElement("classify")
         textbase64.setAttribute("id","Classifytext"+ str(counter))
         ptext = doc.createTextNode(text)
         textbase64.appendChild(ptext)
         classifytag.setAttribute("id","Classify"+ str(counter))
         classifytag.setAttribute("classifierName",classifierName)
         classifytag.setAttribute("textId","Classifytext"+str(counter))
         if username != None:
             classifytag.setAttribute("username",username)
         textstag.appendChild(textbase64)
         readcalls.appendChild(classifytag)
         counter = counter + 1
     r = requests.post(self.api_url,doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text,status_code)
         else:
             return self.parseClassifyResponse(r.content,texts)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #4
0
ファイル: uclassify.py プロジェクト: echwa/pyuClassify
 def create(self,classifierName):
     """Creates a new classifier.
        :param classifierName: (required) The Classifier Name you are going to create.
     """
     doc,root_element = self._buildbasicXMLdoc()
     writecalls = doc.createElement("writeCalls")
     writecalls.setAttribute("writeApiKey",self.writeApiKey) #Add exception handling here
     writecalls.setAttribute("classifierName",classifierName)
     create = doc.createElement("create")
     cur_time = strftime("%Y%m%d%H%M", gmtime())
     create.setAttribute("id",cur_time + "create" + classifierName)
     root_element.appendChild(writecalls)
     writecalls.appendChild(create)
     r = requests.post(self.api_url,doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text,status_code)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #5
0
ファイル: uclassify.py プロジェクト: echwa/pyuClassify
 def removeClassifier(self,classifierName):
     """Removes Classifier.
        :param classifierName(required): Classifier Name
     """
     doc,root_element = self._buildbasicXMLdoc()
     writecalls = doc.createElement("writeCalls")
     if self.writeApiKey == None:
         raise uClassifyError("Write API Key not Initialized")
     writecalls.setAttribute("writeApiKey",self.writeApiKey)
     writecalls.setAttribute("classifierName",classifierName)
     removetag = doc.createElement("remove")
     removetag.setAttribute("id","Remove")
     root_element.appendChild(writecalls)
     writecalls.appendChild(removetag)
     r = requests.post(self.api_url,doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text,status_code)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #6
0
ファイル: uclassify.py プロジェクト: urwithajit9/pyuClassify
 def removeClassifier(self, classifierName):
     """Removes Classifier.
        :param classifierName(required): Classifier Name
     """
     doc, root_element = self._buildbasicXMLdoc()
     writecalls = doc.createElement("writeCalls")
     if self.writeApiKey == None:
         raise uClassifyError("Write API Key not Initialized")
     writecalls.setAttribute("writeApiKey", self.writeApiKey)
     writecalls.setAttribute("classifierName", classifierName)
     removetag = doc.createElement("remove")
     removetag.setAttribute("id", "Remove")
     root_element.appendChild(writecalls)
     writecalls.appendChild(removetag)
     r = requests.post(self.api_url, doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text, status_code)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #7
0
ファイル: uclassify.py プロジェクト: urwithajit9/pyuClassify
 def create(self, classifierName):
     """Creates a new classifier.
        :param classifierName: (required) The Classifier Name you are going to create.
     """
     doc, root_element = self._buildbasicXMLdoc()
     writecalls = doc.createElement("writeCalls")
     writecalls.setAttribute("writeApiKey",
                             self.writeApiKey)  #Add exception handling here
     writecalls.setAttribute("classifierName", classifierName)
     create = doc.createElement("create")
     cur_time = strftime("%Y%m%d%H%M", gmtime())
     create.setAttribute("id", cur_time + "create" + classifierName)
     root_element.appendChild(writecalls)
     writecalls.appendChild(create)
     r = requests.post(self.api_url, doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text, status_code)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #8
0
ファイル: uclassify.py プロジェクト: urwithajit9/pyuClassify
 def untrain(self, texts, className, classifierName):
     """Performs untraining on text for a specific class.
        :param texts: (required) A List of text used up for training.
        :param className: (required) Name of the class.
        :param classifierName: (required) Name of the Classifier
     """
     base64texts = []
     for text in texts:
         base64_text = base64.b64encode(
             text)  #For Python version 3, need to change.
         base64texts.append(base64_text)
     doc, root_element = self._buildbasicXMLdoc()
     textstag = doc.createElement("texts")
     writecalls = doc.createElement("writeCalls")
     if self.writeApiKey == None:
         raise uClassifyError("Write API Key not Initialized")
     writecalls.setAttribute("writeApiKey", self.writeApiKey)
     writecalls.setAttribute("classifierName", classifierName)
     root_element.appendChild(textstag)
     root_element.appendChild(writecalls)
     counter = 1
     for text in base64texts:
         textbase64 = doc.createElement("textBase64")
         traintag = doc.createElement("untrain")
         textbase64.setAttribute("id", className + "Text" + str(counter))
         ptext = doc.createTextNode(text)
         textbase64.appendChild(ptext)
         textstag.appendChild(textbase64)
         traintag.setAttribute("id", "Untrain" + className + str(counter))
         traintag.setAttribute("className", className)
         traintag.setAttribute("textId", className + "Text" + str(counter))
         counter = counter + 1
         writecalls.appendChild(traintag)
     r = requests.post(self.api_url, doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text, status_code)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #9
0
ファイル: uclassify.py プロジェクト: echwa/pyuClassify
 def train(self,texts,className,classifierName):
     """Performs training on a single classs.
        :param texts: (required) A List of text used up for training.
        :param className: (required) Name of the class that needs to be trained.
        :param classifierName: (required) Name of the Classifier
     """
     base64texts = []
     for text in texts:
         base64_text = base64.b64encode(text) #For Python version 3, need to change.
         base64texts.append(base64_text)
     doc,root_element = self._buildbasicXMLdoc()
     textstag = doc.createElement("texts")
     writecalls = doc.createElement("writeCalls")
     if self.writeApiKey == None:
         raise uClassifyError("Write API Key not Initialized")
     writecalls.setAttribute("writeApiKey",self.writeApiKey)
     writecalls.setAttribute("classifierName",classifierName)
     root_element.appendChild(textstag)
     root_element.appendChild(writecalls)
     counter = 1
     for text in base64texts:
         textbase64 = doc.createElement("textBase64")
         traintag = doc.createElement("train")
         textbase64.setAttribute("id",className + "Text" + str(counter))
         ptext = doc.createTextNode(text)
         textbase64.appendChild(ptext)
         textstag.appendChild(textbase64)
         traintag.setAttribute("id","Train"+className+ str(counter))
         traintag.setAttribute("className",className)
         traintag.setAttribute("textId",className + "Text" + str(counter))
         counter = counter + 1
         writecalls.appendChild(traintag)
     r = requests.post(self.api_url,doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text,status_code)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #10
0
ファイル: uclassify.py プロジェクト: urwithajit9/pyuClassify
 def getInformation(self, classifierName):
     """Returns Information about the Classifier in a List.
        :param classifierName: (required) Classifier Name
     """
     doc, root_element = self._buildbasicXMLdoc()
     readcalls = doc.createElement("readCalls")
     if self.readApiKey == None:
         raise uClassifyError("Read API Key not Initialized")
     readcalls.setAttribute("readApiKey", self.readApiKey)
     root_element.appendChild(readcalls)
     getinfotag = doc.createElement("getInformation")
     getinfotag.setAttribute("id", "GetInformation")
     getinfotag.setAttribute("classifierName", classifierName)
     readcalls.appendChild(getinfotag)
     r = requests.post(self.api_url, doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text, status_code)
         else:
             return self._parseClassifierInformation(r.content)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #11
0
ファイル: uclassify.py プロジェクト: echwa/pyuClassify
 def getInformation(self,classifierName):
     """Returns Information about the Classifier in a List.
        :param classifierName: (required) Classifier Name
     """
     doc,root_element = self._buildbasicXMLdoc()
     readcalls = doc.createElement("readCalls")
     if self.readApiKey == None:
         raise uClassifyError("Read API Key not Initialized")
     readcalls.setAttribute("readApiKey",self.readApiKey)
     root_element.appendChild(readcalls)
     getinfotag = doc.createElement("getInformation")
     getinfotag.setAttribute("id","GetInformation")
     getinfotag.setAttribute("classifierName",classifierName)
     readcalls.appendChild(getinfotag)
     r = requests.post(self.api_url,doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text,status_code)
         else:
             return self._parseClassifierInformation(r.content)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #12
0
ファイル: uclassify.py プロジェクト: urwithajit9/pyuClassify
 def addClass(self, className, classifierName):
     """Adds class to an existing Classifier.
        :param className: (required) A List containing various classes that has to be added for the given Classifier.
        :param classifierName: (required) Classifier where the classes will be added to.
     """
     doc, root_element = self._buildbasicXMLdoc()
     writecalls = doc.createElement("writeCalls")
     if self.writeApiKey == None:
         raise uClassifyError("Write API Key not Initialized")
     writecalls.setAttribute("writeApiKey", self.writeApiKey)
     writecalls.setAttribute("classifierName", classifierName)
     root_element.appendChild(writecalls)
     for clas in className:
         addclass = doc.createElement("addClass")
         addclass.setAttribute("id", "AddClass" + clas)
         addclass.setAttribute("className", clas)
         writecalls.appendChild(addclass)
     r = requests.post(self.api_url, doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text, status_code)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #13
0
ファイル: uclassify.py プロジェクト: Kullax/WebScience16
 def removeClassifier(self,classifierName):
     """Removes Classifier.
        :param classifierName(required): Classifier Name
     """
     doc,root_element = self._buildbasicXMLdoc()
     writecalls = doc.createElement("writeCalls")
     writecalls.setAttribute("classifierName",classifierName)
     removetag = doc.createElement("remove")
     removetag.setAttribute("id","Remove")
     root_element.appendChild(writecalls)
     writecalls.appendChild(removetag)
     content = sendData(doc.toxml())
     success, status_code, text = self._getResponseCode(content)
     if success == "false":
         raise uClassifyError(text,status_code)
コード例 #14
0
ファイル: uclassify.py プロジェクト: echwa/pyuClassify
 def addClass(self,className,classifierName):
     """Adds class to an existing Classifier.
        :param className: (required) A List containing various classes that has to be added for the given Classifier.
        :param classifierName: (required) Classifier where the classes will be added to.
     """
     doc, root_element = self._buildbasicXMLdoc()
     writecalls = doc.createElement("writeCalls")
     if self.writeApiKey == None:
         raise uClassifyError("Write API Key not Initialized")
     writecalls.setAttribute("writeApiKey",self.writeApiKey)
     writecalls.setAttribute("classifierName",classifierName)
     root_element.appendChild(writecalls)
     for clas in className:
         addclass = doc.createElement("addClass")
         addclass.setAttribute("id","AddClass" + clas)
         addclass.setAttribute("className",clas)
         writecalls.appendChild(addclass)
     r = requests.post(self.api_url,doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text,status_code)
     else:
         raise uClassifyError("Bad XML Request Sent")
コード例 #15
0
ファイル: uclassify.py プロジェクト: Kullax/WebScience16
 def create(self,classifierName):
     """Creates a new classifier.
        :param classifierName: (required) The Classifier Name you are going to create.
     """
     doc,root_element = self._buildbasicXMLdoc()
     writecalls = doc.createElement("writeCalls")
     writecalls.setAttribute("classifierName",classifierName)
     create = doc.createElement("create")
     cur_time = strftime("%Y%m%d%H%M", gmtime())
     create.setAttribute("id",cur_time + "create" + classifierName)
     root_element.appendChild(writecalls)
     writecalls.appendChild(create)
     success, status_code, text = self._getResponseCode(sendData(doc.toxml()))
     if success == "false":
         raise uClassifyError(text,status_code)
コード例 #16
0
ファイル: uclassify.py プロジェクト: Kullax/WebScience16
 def getInformation(self,classifierName):
     """Returns Information about the Classifier in a List.
        :param classifierName: (required) Classifier Name
     """
     doc,root_element = self._buildbasicXMLdoc()
     readcalls = doc.createElement("readCalls")
     root_element.appendChild(readcalls)
     getinfotag = doc.createElement("getInformation")
     getinfotag.setAttribute("id","GetInformation")
     getinfotag.setAttribute("classifierName",classifierName)
     readcalls.appendChild(getinfotag)
     content = sendData(doc.toxml())
     success, status_code, text = self._getResponseCode(content)
     if success == "false":
         raise uClassifyError(text,status_code)
     else:
         return self._parseClassifierInformation(content)
コード例 #17
0
ファイル: uclassify.py プロジェクト: Kullax/WebScience16
 def addClass(self,className,classifierName):
     """Adds class to an existing Classifier.
        :param className: (required) A List containing various classes that has to be added for the given Classifier.
        :param classifierName: (required) Classifier where the classes will be added to.
     """
     doc, root_element = self._buildbasicXMLdoc()
     writecalls = doc.createElement("writeCalls")
     writecalls.setAttribute("classifierName",classifierName)
     root_element.appendChild(writecalls)
     for clas in className:
         addclass = doc.createElement("addClass")
         addclass.setAttribute("id","AddClass" + clas)
         addclass.setAttribute("className",clas)
         writecalls.appendChild(addclass)
     success, status_code, text = self._getResponseCode(sendData(doc.toxml()))
     if success == "false":
         raise uClassifyError(text,status_code)
コード例 #18
0
ファイル: uclassify.py プロジェクト: urwithajit9/pyuClassify
    def classifyKeywords(self, texts, classifierName, username=None):
        """Performs classification on texts.
           :param texts: (required) A List of texts that needs to be classified.
           :param classifierName: (required) Classifier Name
           :param username: (optional): Name of the user, under whom the classifier exists.
        """
        doc, root_element = self._buildbasicXMLdoc()
        textstag = doc.createElement("texts")
        readcalls = doc.createElement("readCalls")
        if self.readApiKey == None:
            raise uClassifyError("Read API Key not Initialized")
        readcalls.setAttribute("readApiKey", self.readApiKey)
        root_element.appendChild(textstag)
        root_element.appendChild(readcalls)
        base64texts = []
        for text in texts:
            base64_text = base64.b64encode(
                text)  #For Python version 3, need to change.
            base64texts.append(base64_text)
        counter = 1
        for text in base64texts:
            textbase64 = doc.createElement("textBase64")
            classifytag = doc.createElement("classifyKeywords")
            textbase64.setAttribute("id", "Classifytext" + str(counter))
            ptext = doc.createTextNode(text)
            textbase64.appendChild(ptext)
            classifytag.setAttribute("id", "Classify" + str(counter))
            classifytag.setAttribute("classifierName", classifierName)
            classifytag.setAttribute("textId", "Classifytext" + str(counter))
            if username != None:
                classifytag.setAttribute("username", username)
            textstag.appendChild(textbase64)
            readcalls.appendChild(classifytag)
            counter = counter + 1
        r = requests.post(self.api_url, doc.toxml())
        if r.status_code == 200:
            success, status_code, text = self._getResponseCode(r.content)
            if success == "false":
                raise uClassifyError(text, status_code)
            else:
                return self.parseClassifyResponse(r.content, texts)
        else:
            raise uClassifyError("Bad XML Request Sent")

        def parseClassifyKeywordResponse(self, content, texts):
            """Parses the Classifier response from the server.
              :param content: (required) XML Response from server.
            """
            counter = 0
            doc = xml.dom.minidom.parseString(content)
            node = doc.documentElement
            result = []
            keyw = []
            classifytags = node.getElementsByTagName("classification")
            keywordstags = node.getElementsByTagName("keywords")
            for keyword in keywordstags:
                classtags = keyword.getElementsByTagName("class")
                for ctag in classtags:
                    kw = ctag.firstChild.data
                if kw != "":
                    keyw.append(kw)
            for classi in classifytags:
                text_coverage = classi.getAttribute("textCoverage")
                classtags = classi.getElementsByTagName("class")
                cresult = []
                for ctag in classtags:
                    classname = ctag.getAttribute("className")
                    cper = ctag.getAttribute("p")
                    tup = (classname, cper)
                    cresult.append(tup)
                result.append((texts[counter], text_coverage, cresult, keyw))
                counter = counter + 1
            return result
コード例 #19
0
ファイル: uclassify.py プロジェクト: echwa/pyuClassify
 def classifyKeywords(self,texts,classifierName,username = None):
     """Performs classification on texts.
        :param texts: (required) A List of texts that needs to be classified.
        :param classifierName: (required) Classifier Name
        :param username: (optional): Name of the user, under whom the classifier exists.
     """
     doc,root_element = self._buildbasicXMLdoc()
     textstag = doc.createElement("texts")
     readcalls = doc.createElement("readCalls")
     if self.readApiKey == None:
         raise uClassifyError("Read API Key not Initialized")
     readcalls.setAttribute("readApiKey",self.readApiKey)
     root_element.appendChild(textstag)
     root_element.appendChild(readcalls)
     base64texts = []
     for text in texts:
         base64_text = base64.b64encode(text) #For Python version 3, need to change.
         base64texts.append(base64_text)
     counter = 1
     for text in base64texts:
         textbase64 = doc.createElement("textBase64")
         classifytag = doc.createElement("classifyKeywords")
         textbase64.setAttribute("id","Classifytext"+ str(counter))
         ptext = doc.createTextNode(text)
         textbase64.appendChild(ptext)
         classifytag.setAttribute("id","Classify"+ str(counter))
         classifytag.setAttribute("classifierName",classifierName)
         classifytag.setAttribute("textId","Classifytext"+str(counter))
         if username != None:
             classifytag.setAttribute("username",username)
         textstag.appendChild(textbase64)
         readcalls.appendChild(classifytag)
         counter = counter + 1
     r = requests.post(self.api_url,doc.toxml())
     if r.status_code == 200:
         success, status_code, text = self._getResponseCode(r.content)
         if success == "false":
             raise uClassifyError(text,status_code)
         else:
             return self.parseClassifyResponse(r.content,texts)
     else:
         raise uClassifyError("Bad XML Request Sent")
     
     def parseClassifyKeywordResponse(self,content,texts):
         """Parses the Classifier response from the server.
           :param content: (required) XML Response from server.
         """
         counter = 0
         doc = xml.dom.minidom.parseString(content)
         node = doc.documentElement
         result = []
         keyw = []
         classifytags = node.getElementsByTagName("classification")
         keywordstags = node.getElementsByTagName("keywords")
         for keyword in keywordstags:
             classtags = keyword.getElementsByTagName("class")
             for ctag in classtags:
                 kw = ctag.firstChild.data
             if kw != "":
                 keyw.append(kw)
         for classi in classifytags:
             text_coverage = classi.getAttribute("textCoverage")
             classtags = classi.getElementsByTagName("class")
             cresult = []
             for ctag in classtags:
                 classname = ctag.getAttribute("className")
                 cper = ctag.getAttribute("p")
                 tup = (classname,cper)
                 cresult.append(tup)
             result.append((texts[counter],text_coverage,cresult,keyw))
             counter = counter + 1
         return result