Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,56 +0,0 @@
|
|||
with Ada.Characters.Handling; use Ada.Characters.Handling;
|
||||
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
|
||||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
|
||||
procedure Wordwheel is
|
||||
Compulsory_Ix : constant Positive := 5;
|
||||
Min_Length : constant Positive := 3;
|
||||
|
||||
function Char_Posn (Str : Unbounded_String; C : Character) return Natural is
|
||||
begin
|
||||
for Ix in 1 .. Length (Str) loop
|
||||
if Element (Str, Ix) = C then
|
||||
return Ix;
|
||||
end if;
|
||||
end loop;
|
||||
return 0;
|
||||
end Char_Posn;
|
||||
|
||||
procedure Search (Dict_Filename : String; Wheel : String) is
|
||||
Dict_File : File_Type;
|
||||
Allowed : constant String := To_Lower (Wheel);
|
||||
Required_Char : constant String (1 .. 1) := "" & Allowed (Compulsory_Ix);
|
||||
Available, Dict_Word : Unbounded_String;
|
||||
Dict_Word_Len : Positive;
|
||||
Matched : Boolean;
|
||||
Posn : Natural;
|
||||
begin
|
||||
Open (File => Dict_File, Mode => In_File, Name => Dict_Filename);
|
||||
while not End_Of_File (Dict_File) loop
|
||||
Dict_Word := Get_Line (Dict_File);
|
||||
Dict_Word_Len := Length (Dict_Word);
|
||||
if Dict_Word_Len >= Min_Length and then
|
||||
Dict_Word_Len <= Wheel'Length and then
|
||||
Ada.Strings.Unbounded.Count (Dict_Word, Required_Char) > 0
|
||||
then
|
||||
Available := To_Unbounded_String (Allowed);
|
||||
Matched := True;
|
||||
for i in 1 .. Dict_Word_Len loop
|
||||
Posn := Char_Posn (Available, Element (Dict_Word, i));
|
||||
if Posn > 0 then
|
||||
Delete (Source => Available, From => Posn, Through => Posn);
|
||||
else
|
||||
Matched := False;
|
||||
exit;
|
||||
end if;
|
||||
end loop;
|
||||
if Matched then
|
||||
Put_Line (Dict_Word);
|
||||
end if;
|
||||
end if;
|
||||
end loop;
|
||||
Close (Dict_File);
|
||||
end Search;
|
||||
begin
|
||||
Search ("unixdict.txt", "ndeokgelw");
|
||||
end Wordwheel;
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
use std::fs::read_to_string;
|
||||
|
||||
fn main() {
|
||||
let wordsfile = fs::read_to_string("unixdict.txt").unwrap().to_lowercase();
|
||||
let wordsfile = read_to_string("unixdict.txt").unwrap().to_lowercase();
|
||||
let wheel = "ndeokgelw".to_string();
|
||||
let middle = &wheel[4..=4];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
Const wheel="ndeokgelw"
|
||||
|
||||
Sub print(s):
|
||||
On Error Resume Next
|
||||
WScript.stdout.WriteLine (s)
|
||||
If err= &h80070006& Then WScript.Echo " Please run this script with CScript": WScript.quit
|
||||
End Sub
|
||||
|
||||
Dim oDic
|
||||
Set oDic = WScript.CreateObject("scripting.dictionary")
|
||||
Dim cnt(127)
|
||||
Dim fso
|
||||
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
|
||||
Set ff=fso.OpenTextFile("unixdict.txt")
|
||||
i=0
|
||||
print "reading words of 3 or more letters"
|
||||
While Not ff.AtEndOfStream
|
||||
x=LCase(ff.ReadLine)
|
||||
If Len(x)>=3 Then
|
||||
If Not odic.exists(x) Then oDic.Add x,0
|
||||
End If
|
||||
Wend
|
||||
print "remaining words: "& oDic.Count & vbcrlf
|
||||
ff.Close
|
||||
Set ff=Nothing
|
||||
Set fso=Nothing
|
||||
|
||||
Set re=New RegExp
|
||||
print "removing words with chars not in the wheel"
|
||||
re.pattern="[^"& wheel &"]"
|
||||
For Each w In oDic.Keys
|
||||
If re.test(w) Then oDic.remove(w)
|
||||
Next
|
||||
print "remaining words: "& oDic.Count & vbcrlf
|
||||
|
||||
print "ensuring the mandatory letter "& Mid(wheel,5,1) & " is present"
|
||||
re.Pattern=Mid(wheel,5,1)
|
||||
For Each w In oDic.Keys
|
||||
If Not re.test(w) Then oDic.remove(w)
|
||||
Next
|
||||
print "remaining words: "& oDic.Count & vbcrlf
|
||||
|
||||
print "checking number of chars"
|
||||
|
||||
Dim nDic
|
||||
Set nDic = WScript.CreateObject("scripting.dictionary")
|
||||
For i=1 To Len(wheel)
|
||||
x=Mid(wheel,i,1)
|
||||
If nDic.Exists(x) Then
|
||||
a=nDic(x)
|
||||
nDic(x)=Array(a(0)+1,0)
|
||||
Else
|
||||
nDic.add x,Array(1,0)
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each w In oDic.Keys
|
||||
For Each c In nDic.Keys
|
||||
ndic(c)=Array(nDic(c)(0),0)
|
||||
Next
|
||||
For ii = 1 To len(w)
|
||||
c=Mid(w,ii,1)
|
||||
a=nDic(c)
|
||||
If (a(0)=a(1)) Then
|
||||
oDic.Remove(w):Exit For
|
||||
End If
|
||||
nDic(c)=Array(a(0),a(1)+1)
|
||||
Next
|
||||
Next
|
||||
|
||||
print "Remaining words "& oDic.count
|
||||
For Each w In oDic.Keys
|
||||
print w
|
||||
Next
|
||||
Loading…
Add table
Add a link
Reference in a new issue