This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import Counter, defaultdict | |
| def get_pairs(word): | |
| """Return set of symbol pairs in a word.""" | |
| pairs = set() | |
| prev_char = word[0] | |
| for char in word[1:]: | |
| pairs.add((prev_char, char)) | |
| prev_char = char | |
| return pairs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <bitset> | |
| using namespace std; | |
| string POLYNOMIAL = "10001000000100001"; | |
| string TextToBinaryString(string words) { | |
| string binaryString = ""; | |
| for (char& _char : words) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from sympy import Matrix | |
| CHAR_TABLE = {chr(i+97): i for i in range(0,26)} | |
| CHAR_TABLE_REV = dict(zip(CHAR_TABLE.values(), CHAR_TABLE.keys())) | |
| def program(): | |
| #take user input | |
| #plain_text = sanitize(input("Enter Plain Text: ")) |