<commit_before>module SW.SymbolConverter exposing (..)

import ParseInt as ParseInt exposing (..)
import String as String exposing (..)
import Char as Char exposing (..)
import Bitwise as Bitwise exposing (..)
import SW.Types exposing (..)

rotation : Code -> Rotation
rotation code =
    code % 16


fill : Code -> Fill
fill code =
    (code // 16) % 6 + 1


base : Code -> Base
base code =
    (code // 96) + 256


code : Base -> Fill -> Rotation -> Code
code base fill rotation =
  0x100000 +  96 * (base- 256) + 16 * (fill) + rotation +1


key : Base -> Fill -> Rotation -> Key
key base fill rotation =
    "S" ++ dectoHex base ++ dectoHex (fill - 1) ++ dectoHex (rotation - 1)

dectoHex : Int -> String
dectoHex value =
    ParseInt.toRadix' 16 value


hextoDec : String -> Int
hextoDec value =
    ParseInt.parseIntHex value |> Result.toMaybe |> Maybe.withDefault 0


keyfromcode : Code -> Key
keyfromcode code =
    key (base code) (fill code) (rotation code)


hexbaseFromKey : Key -> Base
hexbaseFromKey key =<commit_msg>Fix SymbolConverter<commit_after>module SW.SymbolConverter exposing (..)

import ParseInt as ParseInt exposing (..)
import String as String exposing (..)
import Char as Char exposing (..)
import Bitwise as Bitwise exposing (..)
import SW.Types exposing (..)

rotation : Int -> Int
rotation code =
    (code - 0x100000 ) % 16


fill : Int -> Int
fill code =
    ((code - 0x100000 ) // 16) % 6 + 1


base : Int -> Int
base code =
    ((code - 0x100000 ) // 96) + 256 

code : Base -> Fill -> Rotation -> Code
code base fill rotation =
  0x100000 +  96 * (base- 256) + 16 * (fill) + rotation +1


key : Base -> Fill -> Rotation -> Key
key base fill rotation =
    "S" ++ dectoHex base ++ dectoHex (fill - 1) ++ dectoHex (rotation - 1)

dectoHex : Int -> String
dectoHex value =
    ParseInt.toRadix' 16 value


hextoDec : String -> Int
hextoDec value =
    ParseInt.parseIntHex value |> Result.toMaybe |> Maybe.withDefault 0


keyfromcode : Code -> Key
keyfromcode code =
    key (base code) (fill code) (rotation code)


hexbaseFromKey : Key -> Base
hexbaseFromKey key =
{'fraction_non_alphanumeric': 0.1234509056244042, 'fraction_numerical': 0.03956148713060057, 'mean_word_length': 2.9307116104868913, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, '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': '211102', 'n_tokens_mistral': 776, 'n_tokens_neox': 679, 'n_words': 244}