コード例 #1
0
 def __init__(self, id, H, HI, F1, IF1, W1, IW1, F2, IF2, W2, IW2, CTLT):
     self.__latentTopic=LatentTopic(id, "", H, HI, F1, IF1, W1, IW1, F2, IF2, W2, IW2)
     self.__controlTypeLatentTopic=CTLT
コード例 #2
0
class ControlLatentTopic:
    """Control entity whose function is to be a layer between the user and LatentTopic model, 
    also it will be the only thing the user can see and use to access and work with the model.

	
    Parameters
    ----------
    id : int,
        ID of the LatentTopic
    name: String 
        Name of the LatentTopic.
    H: array or matrix, 
        Vector of belonging degrees of each Document to the Latent Topic.
    F1: array or matrix, 
        Basis of the Latent Topic.
    W1: array or matrix, 
        Basis of the Latent Topic in terms of the documents.
    F2: array or matrix, 
        Basis of the Latent Topic on the Asymmetric Factorization.
    W2: array or matrix, 
        Basis of the Latent Topic in terms of the documents on the Asymmetric Factorization.
	
    Attributes
    ----------
        controlTypeLatentTopic : ControlTypeLatentTopic control entity.
        latentTopic : LatentTopic entity. 	
	
    Example
    -------
    """   
    def __init__(self, id, H, HI, F1, IF1, W1, IW1, F2, IF2, W2, IW2, CTLT):
        self.__latentTopic=LatentTopic(id, "", H, HI, F1, IF1, W1, IW1, F2, IF2, W2, IW2)
        self.__controlTypeLatentTopic=CTLT

    

    def getBelongingDegree(self,identificador):
        """ Return the belong degree of the document, -1 if the document is not on the dictionary.
            That means the document was not on the initial list of documents.
        """
        id=self.__controlTypeLatentTopic.getDictionary(identificador)
        if id!=None:
            return self.__latentTopic.getBelongingVector(id)
        else:
            return -1



    def getModalResume(self, type=True):
        """Return a sorted index list of the array representativeWords or resumeWords."""
        if type:
            return self.__latentTopic.getSortedIndexRepresentativeWords()
        else:
            return self.__latentTopic.getSortedIndexResumeWords()

    

    def getDocumentResume(self, type=1):
        """Return a sorted index list of the array representativeDocuments or resumeDocuments."""
        if type == 1:
            return self.__latentTopic.getSortedIndexBelongingVector()
        if type == 2:
            return self.__latentTopic.getSortedIndexReoresentativeDocuments()
        return self.__latenTopic.getSortedIndexResumeDocuments()
        

    
    def setLatantTopicName(self, name):
        """ Change the LatentTopic name."""
        self.__latentTopic.setName(name)



    def getLatantTopicName(self):
        """ Change the LatentTopic name."""
        return self.__latentTopic.getName()



    def getLatantTopicId(self):
        """ Change the LatentTopic name."""
        return self.__latentTopic.getId()