Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -11,11 +11,11 @@ tcount: 0
|
|||
|
||||
loop words 'w [
|
||||
p: phone w
|
||||
if? key? textonyms p [
|
||||
switch key? textonyms p [
|
||||
textonyms\[p]: textonyms\[p] ++ w
|
||||
if 2 = size textonyms\[p] -> 'tcount + 1
|
||||
]
|
||||
else -> textonyms\[p]: @[w]
|
||||
-> textonyms\[p]: @[w]
|
||||
]
|
||||
|
||||
print ~{
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
$url = "http://www.puzzlers.org/pub/wordlists/unixdict.txt"
|
||||
$file = "$env:TEMP\unixdict.txt"
|
||||
(New-Object System.Net.WebClient).DownloadFile($url, $file)
|
||||
$unixdict = Get-Content -Path $file
|
||||
|
||||
[string]$alpha = "abcdefghijklmnopqrstuvwxyz"
|
||||
[string]$digit = "22233344455566677778889999"
|
||||
|
||||
$table = [ordered]@{}
|
||||
|
||||
for ($i = 0; $i -lt $alpha.Length; $i++)
|
||||
{
|
||||
$table.Add($alpha[$i], $digit[$i])
|
||||
}
|
||||
|
||||
$words = foreach ($word in $unixdict)
|
||||
{
|
||||
if ($word -match "^[a-z]*$")
|
||||
{
|
||||
[PSCustomObject]@{
|
||||
Word = $word
|
||||
Number = ($word.ToCharArray() | ForEach-Object {$table.$_}) -join ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$digitCombinations = $words | Group-Object -Property Number
|
||||
|
||||
$textonyms = $digitCombinations | Where-Object -Property Count -GT 1 | Sort-Object -Property Count -Descending
|
||||
|
||||
Write-Host ("There are {0} words in {1} which can be represented by the digit key mapping." -f $words.Count, $url)
|
||||
Write-Host ("They require {0} digit combinations to represent them." -f $digitCombinations.Count)
|
||||
Write-Host ("{0} digit combinations represent Textonyms.`n" -f $textonyms.Count)
|
||||
|
||||
Write-Host "Top 5 in ambiguity:"
|
||||
$textonyms | Select-Object -First 5 -Property Count,
|
||||
@{Name="Textonym"; Expression={$_.Name}},
|
||||
@{Name="Words" ; Expression={$_.Group.Word -join ", "}} | Format-Table -AutoSize
|
||||
Write-Host "Top 5 in length:"
|
||||
$textonyms | Sort-Object {$_.Name.Length} -Descending |
|
||||
Select-Object -First 5 -Property @{Name="Length" ; Expression={$_.Name.Length}},
|
||||
@{Name="Textonym"; Expression={$_.Name}},
|
||||
@{Name="Words" ; Expression={$_.Group.Word -join ", "}} | Format-Table -AutoSize
|
||||
|
||||
Remove-Item -Path $file -Force -ErrorAction SilentlyContinue
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||
Set objInFile = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_
|
||||
"\unixdict.txt",1)
|
||||
Set objKeyMap = CreateObject("Scripting.Dictionary")
|
||||
With objKeyMap
|
||||
.Add "ABC", "2" : .Add "DEF", "3" : .Add "GHI", "4" : .Add "JKL", "5"
|
||||
.Add "MNO", "6" : .Add "PQRS", "7" : .Add "TUV", "8" : .Add "WXYZ", "9"
|
||||
End With
|
||||
|
||||
'Instantiate or Intialize Counters
|
||||
TotalWords = 0
|
||||
UniqueCombinations = 0
|
||||
Set objUniqueWords = CreateObject("Scripting.Dictionary")
|
||||
Set objMoreThanOneWord = CreateObject("Scripting.Dictionary")
|
||||
|
||||
Do Until objInFile.AtEndOfStream
|
||||
Word = objInFile.ReadLine
|
||||
c = 0
|
||||
Num = ""
|
||||
If Word <> "" Then
|
||||
For i = 1 To Len(Word)
|
||||
For Each Key In objKeyMap.Keys
|
||||
If InStr(1,Key,Mid(Word,i,1),1) > 0 Then
|
||||
Num = Num & objKeyMap.Item(Key)
|
||||
c = c + 1
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
If c = Len(Word) Then
|
||||
TotalWords = TotalWords + 1
|
||||
If objUniqueWords.Exists(Num) = False Then
|
||||
objUniqueWords.Add Num, ""
|
||||
UniqueCombinations = UniqueCombinations + 1
|
||||
Else
|
||||
If objMoreThanOneWord.Exists(Num) = False Then
|
||||
objMoreThanOneWord.Add Num, ""
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Loop
|
||||
|
||||
WScript.Echo "There are " & TotalWords & " words in ""unixdict.txt"" which can be represented by the digit key mapping." & vbCrLf &_
|
||||
"They require " & UniqueCombinations & " digit combinations to represent them." & vbCrLf &_
|
||||
objMoreThanOneWord.Count & " digit combinations represent Textonyms."
|
||||
|
||||
objInFile.Close
|
||||
Loading…
Add table
Add a link
Reference in a new issue