Sie sind auf Seite 1von 20

LIE DETECTOR

COGNITIVE INTERVIEWING

Cre By
Van & San
Introduction
Based on the research of Dr. Charles A. Morgan, the method of polygraph that
is used by official organization to detect lies are not very effective. He mentions
that the person who is interviewed can be trained to hide the truth behind usual
behaviours so that they don’t show any obvious signals that they are lying. Apart
from that, he states that people who are lying, either trained or not, are likely to
speak less information and probably repeat some words for several times. It is
believed that the people who are lying will avoid giving out details and try to
convince other people to accept their words by saying some keywords many times.
Therefore, Dr. Morgan suggests that we might have a better chance at detecting lies
if we can analyze the repetition of unique words in a particular statement.
Concepts
As we have learned about Scanner class and Arrays from the previous classes,
we decided to use a Scanner to get the input from the user, which would play as
the statement for our lie detector. We also thought that we would use Delimiters to
eliminate the commonly used words such as ‘I,’ ‘and,’ ‘the,’ and ‘is,’ etc. Then, we
would convert the statement which is in the form of String into an Array that
contains words from the statement. After that we would create different Loops that
would detect repetition of various words in the Array, and compare the percentage of
repetition to the total amounts of word in the whole statement. In this case, if
there are more than 50% of repetition occurs in the statement, we would consider
that statement as a lie and anyone with repetition under 50% would be the truth.
Original Plan
1. Obtain a statement using the Scanner class.
2. Use a delimiter to eliminate common use words such as
‘the,’ and ‘and,’ etc.
3. Create an array containing the string from the Scanner by
splitting up the words.
4. Check for repeated words and print them out.
First Draft
Methods:
1. Scanner class (line 8) - obtain the
story
2. String (line 9) - store the story from
the Scanner as a string
3. Delimiter (line 13) - eliminate
unwanted punctuations, characters, or
words
4. while loop (line 15) - store the split
message into a string
5. String[] (line 21) - turn the string
into an array
6. for loop (line 25) - check for
repetition and print the repeated word
Running the Code
The Output:

1. The string after using the delimiter


2. The array containing the split words
3. The repeated word in the array

The Problem(s):

Running the code just give out the


word that is repeated but not the number
of repetition occurs, which is the important
factor that will indicate if the story that is
being told is a lie or not.
Second Plan
1. Continue with the first plan without the delimiter.
2. Count the amounts of words.
3. Count the amounts of repeated words.
4. Compare the percentage of repeated words to total
words.
5. Process if the story is a lie or not.
Second Draft Part 1
Methods:
1. Scanner class (line 10) - obtain story
2. String (line 11) - convert story into string
3. String message[] (line 15) - split into array
4. message.length (line 17) - count and print
out the length of the story
5. int (line 19) - create a variable to store the
number of repetition
6. for loop (line 21) - this for loop set the
reference word
7. for loop (line 22) - this for loop set the
word that is being checked with the
reference word
8. if (line 24) - add a value to variable repeat
if there is a repetition
Second Draft Part 2
17. println (line 31) - Tell the user
how many words are repeated
18. float (line 34) - convert the
amount of repeated words into
percentage
19. println (line 36) - Tell the user
the percentage of repeated word
20. if / else (line 39) - categorized
the percentage so that if it is
more that 60%, it will the
the user that the statement
is a lie, otherwise it is the
truth.
Running the Code 2
The Output:

1. The length of the story


2. The amounts of repeated words
3. The percentage of the repetitions
4. The conclusion

The Problem(s):

As you see here, the actual


repetition is 16 words ( 1 and +),
however the result comes out as 57.
What Went Wrong? The action inside the if occur every
time it finds the same word, so when
that what is repeated more than two
times, it will be counted from every
word before it.

Sounds confusing?
So basically if there are 6 “a” , it will
be counted as 15.

a a a a a a
15
What should we do?
Add break; ?

Now it’s 5!!!!!!

a a a a a a 5 How do we get it to 6?!


…..
Just add 1 to repeat!
Right?
Well…..
HOW?
Final Plan
1. Continue with the second plan.
2. Change every Uppercase to Lowercase.
3. Use delimiter to eliminate periods and commas.
4. Add an if to check whether reference word is the first or not.
5. Add more comments to prevent future confusion.
6. Check for any errors.
Final Draft Part 1
Methods:
1. Scanner class (line 13) - obtain
the story
2. String (line 14) - convert the
input into a string
3. String (line 15) - change
Uppercase to Lowercase
4. Delimiter (line 19) - eliminate
periods and commas
5. while loop (line 21) - store the
split message into a string
Final Draft Part 2
6. String[] (line 26) - turn the
string into an array
7. message.length (line 31) -
count the number of words in
the story and print the value
out
8. for loop (line 34-35) -
this loop set the reference
Word and check it with other
words in the array. (counting
backwards)
Final Draft Part 3
10. if (line 37) - add a value to variable
repeat if there is a repetition
11. int (line 40) - set the variable count
as the gap between the first word that
was checked and the current reference
word
12. if (line 44) - to check whether the
same word has already found on the
list or not, if yes, then the loop breaks
13. else if (line 47) - however if the two
words that are being checked are not
the same, count will decrease by 1
14. if (line 52) - if the value of count
was all subtracted to zero, then we
will add 1 to repeat
Final Draft Part 4
15. println (line 61) - print the
number of repetitions and the
total amount of words
16. float (line 63) - calculate the
percentage of repetition
17. println (line 65) - print the
percentage of repetition
18. if (line 70) - check if the story
is a lie and print out the
conclusion
19. else (line 3) - print out the
conclusion if the story is not a
lie
Running the Code

The Output:

1. The length of the story


2. The total repetitions occurs in
the story
3. The percentage of the
repetitions to the total
amounts of words
4. The conclusion
EXAMPLE TESTS

Das könnte Ihnen auch gefallen