<commit_before>from matrix import Matrix

#The encoding matrix
encoding_matrix = Matrix([
    [1, 1, 0, 1],
    [1, 0, 1, 1],
    [1, 0, 0, 0],
    [0, 1, 1, 1],
    [0, 1, 0, 0],
    [0, 0, 1, 0],
    [0, 0, 0, 1]
    ])

#The parity checking matrix
checking_matrix = Matrix([
  [1, 0, 1, 0, 1, 0, 1],
  [0, 1, 1, 0, 0, 1, 1],
  [0, 0, 0, 1, 1, 1, 1]
  ])

#Takes a string with a four 0's or 1's as argument and adds the parity bits
#Returns result as vector
def encodemessage(message):
  #Turns the message into a column vector
  vectorlist = []
  for i in range(4):
    vectorlist.append([int(message[i])])
  vector = Matrix(vectorlist)
  #Encodes with the encode matrix
  vector_with_paritybits = encoding_matrix*vector
  return vector_with_paritybits.getbinary()

#Example:
#boodschap = input('Vul hier je boodschap in: ')
#boodschapbinair = map(bin, bytearray(boodschap, 'utf8'))

<commit_msg>checker<commit_after>from matrix import Matrix

#The encoding matrix
encoding_matrix = Matrix([
    [1, 1, 0, 1],
    [1, 0, 1, 1],
    [1, 0, 0, 0],
    [0, 1, 1, 1],
    [0, 1, 0, 0],
    [0, 0, 1, 0],
    [0, 0, 0, 1]
    ])

#The parity checking matrix
checking_matrix = Matrix([
  [1, 0, 1, 0, 1, 0, 1],
  [0, 1, 1, 0, 0, 1, 1],
  [0, 0, 0, 1, 1, 1, 1]
  ])

#Takes a string with a four 0's or 1's as argument and adds the parity bits
#Returns result as vector
def encodemessage(message):
  #Turns the message into a column vector
  vectorlist = []
  for i in range(4):
    vectorlist.append([int(message[i])])
  vector = Matrix(vectorlist)
  #Encodes with the encode matrix
  vector_with_paritybits = encoding_matrix*vector
  return vector_with_paritybits.getbinary()


def checkmessage(message):
  #Turns the message into a column vector
  vectorlist = []
  for i in range(4):
    vectorlist.append([int(message[i])])
  vector = Matrix(vectorlist)
  #Encodes with the encode matrix
  vector_with_paritybits = checking_matrix*vector
  return vector_with_paritybits.getbinary()


#Example:
#boodschap = input('Vul hier je boodschap in: ')
#boodschapbinair = map(bin, bytearray(boodschap, 'utf8'))


{'fraction_non_alphanumeric': 0.13986679352997144, 'fraction_numerical': 0.05090390104662226, 'mean_word_length': 3.6941964285714284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '776558', 'n_tokens_mistral': 889, 'n_tokens_neox': 791, 'n_words': 268}