Ejemplo n.º 1
0
    def test_has_cluster_unknown_with_unknown_type(self):

        self.assertTrue(
            WordClusters('brown', 'brown_file',
                         unknown_type="<UNK>").hasCluster('unknown type'))
Ejemplo n.º 2
0
    def test_has_cluster_unknown_without_unknown_type(self):

        self.assertFalse(
            WordClusters('brown', 'brown_file').hasCluster('unknown type'))
Ejemplo n.º 3
0
    def test_is_oov(self):

        self.assertTrue(
            WordClusters('brown', 'brown_file',
                         unknown_type="<UNK>").isOOV('unknown type'))
Ejemplo n.º 4
0
    def test_has_cluster_known(self):

        self.assertTrue(
            WordClusters('brown', 'brown_file',
                         unknown_type="<UNK>").hasCluster('cat'))
Ejemplo n.º 5
0
    def test_clusters_unknown_not_in_same_cluster(self):

        self.assertFalse(
            WordClusters('brown', 'brown_file',
                         unknown_type="<UNK>").inSameCluster(
                             'mouse', 'unknown type'))
Ejemplo n.º 6
0
    def test_clusters_unknown_without_unknown_type(self):

        self.assertTrue(
            WordClusters('brown',
                         'brown_file').inSameCluster('unknown type',
                                                     'another unknown'))
Ejemplo n.º 7
0
    def test_clusters_unknown_in_same_cluster(self):

        self.assertTrue(
            WordClusters('brown', 'brown_file',
                         unknown_type="<UNK>").inSameCluster(
                             'cat', 'unknown type'))
Ejemplo n.º 8
0
    def test_clusters_unknown_not_in_vocabulary(self):

        with self.assertRaises(ValueError):
            WordClusters('brown', 'brown_file', unknown_type="unknown type")
Ejemplo n.º 9
0
    def test_clusters_not_in_same_cluster(self):

        self.assertFalse(
            WordClusters('brown', 'brown_file').inSameCluster('cat', 'mouse'))
Ejemplo n.º 10
0
    def test_clusters_in_same_cluster(self):

        self.assertTrue(
            WordClusters('brown', 'brown_file').inSameCluster('cat', 'dog'))
Ejemplo n.º 11
0
    def test_cluster_type_not_supported(self):

        with self.assertRaises(ValueError):
            WordClusters('Unknown type', 'brown_file')