Remove double word typos.
This commit removes typos consisting of an accidentally repeated
word. Attached below is the python script I used to find them.
It is worth noting that there is a large false positive rate here, for
example, in tria_accessor.h we have the sentence
/**
* [...] As a
* consequence, it exists in the mesh to ensure that each processor has all
* coarse mesh cells and that the 2:1 ratio of neighboring cells is
* maintained, but it is not one of the cells we should work on on the
* current processor. [...]
*/
Here 'on on' is correct.
script:
import sys
SKIP = ["//", "*", "}", "|", "};", ">", "\"", "|", "/", "numbers::invalid_unsigned_int,", "std::string,", "int,"]
with open(sys.argv[1], 'r') as handle:
previous_line = ""
for line_n, line in enumerate(handle):
line = line.strip()
previous_words = previous_line.split()
words = line.split()
# ignore comment blocks '*' and comment starts '//' at the beginning of
# each line.
if len(words) == 0:
continue
if words[0] in ["*", "//"]:
words = words[1:]
# See if the last word on the previous line is equal to the first word
# on the current line.
if len(previous_words) != 0:
if words[0] not in SKIP and previous_words[-1] == words[0]:
print(sys.argv[1] + ":{}: {}".format(line_n + 1, previous_line))
print(sys.argv[1] + ":{}: {}".format(line_n + 2, line))
previous_line = line
for left_word, right_word in zip(words[:-1], words[1:]):
if left_word == right_word and left_word not in SKIP:
print(sys.argv[1] + ":{}: {}".format(line_n + 1, line))
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams