Exemplo n.º 1
0
def maximumFactor(sentence1, sentence2, n):
    if (n == 1):
        car1 = cardinality.softCardinality1(sentence1)
        car2 = cardinality.softCardinality2(sentence2)

    if (n == 2):
        car1 = cardinality.softCardinality2(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return max(car1, car2)

    elif (n == 3):
        car1 = cardinality.softCardinality3(sentence1)
        car2 = cardinality.softCardinality3(sentence2)
Exemplo n.º 2
0
def fourthMeanFactor(sentence1, sentence2, n):
    if (n == 1):
        car1 = cardinality.softCardinality1(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return (0.5 * (car1**4 + car2**4))**(1 / 4.0)

    if (n == 2):
        car1 = cardinality.softCardinality2(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return (0.5 * (car1**4 + car2**4))**(1 / 4.0)

    elif (n == 3):
        car1 = cardinality.softCardinality3(sentence1)
        car2 = cardinality.softCardinality3(sentence2)
        return (0.5 * (car1**4 + car2**4))**(1 / 4.0)
Exemplo n.º 3
0
def cubicMeanFactor(sentence1, sentence2, n):
    if (n == 1):
        car1 = cardinality.softCardinality1(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return (0.5 * (car1**3 + car2**3))**(1 / 3.0)

    if (n == 2):
        car1 = cardinality.softCardinality2(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return (0.5 * (car1**3 + car2**3))**(1 / 3.0)

    elif (n == 3):
        car1 = cardinality.softCardinality3(sentence1)
        car2 = cardinality.softCardinality3(sentence2)
        return (0.5 * (car1**3 + car2**3))**(1 / 3.0)
Exemplo n.º 4
0
def quadriticMeanFactor(sentence1, sentence2, n):
    if (n == 1):
        car1 = cardinality.softCardinality1(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return math.sqrt(0.5 * (car1**2 + car2**2))

    if (n == 2):
        car1 = cardinality.softCardinality2(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return math.sqrt(0.5 * (car1**2 + car2**2))

    elif (n == 3):
        car1 = cardinality.softCardinality3(sentence1)
        car2 = cardinality.softCardinality3(sentence2)
        return math.sqrt(0.5 * (car1**2 + car2**2))
Exemplo n.º 5
0
def geometricMeanFactor(sentence1, sentence2, n):
    if (n == 1):
        car1 = cardinality.softCardinality1(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return math.sqrt(car1 * car2)

    if (n == 2):
        car1 = cardinality.softCardinality2(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return math.sqrt(car1 * car2)

    elif (n == 3):
        car1 = cardinality.softCardinality3(sentence1)
        car2 = cardinality.softCardinality3(sentence2)
        return math.sqrt(car1 * car2)
Exemplo n.º 6
0
def meanFactor(sentence1, sentence2, n):
    if (n == 1):
        car1 = cardinality.softCardinality1(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return 0.5 * (car1 + car2)

    if (n == 2):
        car1 = cardinality.softCardinality2(sentence1)
        car2 = cardinality.softCardinality2(sentence2)
        return 0.5 * (car1 + car2)

    elif (n == 3):
        car1 = cardinality.softCardinality3(sentence1)
        car2 = cardinality.softCardinality3(sentence2)
        return 0.5 * (car1 + car2)
Exemplo n.º 7
0
def unionFactor(sentence1, sentence2, n):
    if (n == 1):
        ans += cardinality.softCardinality1(sentence1)
        ans += cardinality.softCardinality1(sentence2)
        ans += intersectionFactor(sentence1, sentence2)
        return ans

    elif (n == 2):
        ans += cardinality.softCardinality2(sentence1)
        ans += cardinality.softCardinality2(sentence2)
        ans += intersectionFactor(sentence1, sentence2)
        return ans

    elif (n == 3):
        ans += cardinality.softCardinality3(sentence1)
        ans += cardinality.softCardinality3(sentence2)
        ans += intersectionFactor(sentence1, sentence2)
        return ans
Exemplo n.º 8
0
import cardinality
import getSentences
import extractParaphrase

sentence1 = getSentences.getSentence()
sentence2 = getSentences.getSentence()
bagOfWords1 = getSentences.getPreprocessedBagOfWords(sentence1)
bagOfWords2 = getSentences.getPreprocessedBagOfWords(sentence2)

# bagOfWords1 = getWordBag(sentence1)
# bagOfWords2 = getWordBag(sentence2)

# preprocessedBagOfWords = getPreprocessedBagOfWords(sentence)

# car1 = softCardinality1(sentence)
car2 = cardinality.softCardinality2(sentence1)
car3 = cardinality.softCardinality3(sentence2)
# car2 = softCardinality2(sentence)
# car3 = softCardinality3(sentence)
# print "Car1 = " + str(car1)
print "Car2-1 = " + str(car2)
# print "Car2 = " + str(car2)
print "Car3-2 = " + str(car3)

# listA , negated = sentenceProcessing(sentence)

# print listA
# print negated

print "Printing factors values: "
print "Inter: " + str(