토요일 일주일 중 가장 인기가 없는 날은 아닙니다.
거의 1년 전부터 저는 트위터에서 인기 단어 데이터를 수집하기 시작했습니다. 예술적인 비디오를 만드는 것 외에는 실제 목표를 염두에 두지 않았습니다. 몇 번의 정전을 제외하면 데이터는 5분마다 10곳을 샘플링하여 꽤 완전합니다.
A Linux shell window logging the captures.A Linux shell window logging the captures.A Linux shell window logging the captures.A Linux shell window logging the captures.캡처를 기록하는 Linux 셸 창입니다.
Twitter API의 일반적인 결과는 다음과 같습니다.
["2022-10-06 21:20:00.366761",
"#SheHulk", "Matt Ryan", "Colts", "Colts", "Mario", "Hines",
"#TNFonPrime", "Bowser", "#ThursdayNightFootball",
"Russell Wilson", "#FanDuelisTheGREATEST", "#INDvsDEN",
"Judy Tenuta", "Quavo", "Graphic B", "Hunter Biden", "Saweetie",
"Matty Ice", "Luigi", "Phillip Lindsay", "Caden Sterns", "Jovic",
"Charles Martinet", "Marijuana", "Offset", "Kathy", "Dank Brandon",
"Carina", "Pittman", "Sasse", "Brooklyn", "Commanders vs Bears",
"Frank Reich", "Primetime", "Elvis", "Mushroom Kingdom", "Jamal Cain",
"Toad", "Sara Lee", "Sam Ehlinger", "Darren Bailey", "Norville",
"Deon Jackson", "Rodney Thomas", "Ryan Kelly",
"Mumbles McTouchdown", "Melvin Gordon", "Ranboo", "Illumination", ""]
일반적으로 각 위치에는 50개의 인기 용어가 있습니다. 미국의 9개 위치에는 공통된 단어가 많으며 추세는 5분 동안 지속됩니다. 작은 추세라도 많은 영향을 받습니다. 다음은 파일을 로드하고 단어와 빈도 테이블을 만드는 데 사용하는 JSL입니다.
// for this quick test I copied the json files to my desktop.
// probably should put them in their own directory...
dir = "$desktop/";
names = Filter Each( {j}, Files In Directory( dir ), Ends With( j, ".json" ) );
// I'll need a list of open data tables
dtfiles = {};
For Each( {file}, names, Insert Into( dtfiles, Open( dir || file, JSON Settings( Col( "/root", Type( "JSON Lines" ) ) ) ) ) );
// I'll use an associative array to gather the frequency info
WordToFrequency = [=> 0];
For Each( {dt}, dtfiles,
For Each Row( dt,
// there are a lot of ways to do this; here it makes a list of col2..col51 from the current row
row = dt[Row(), 2 :: N Cols( dt )];
// then process the list
For Each( {word}, row, WordToFrequency[word] += 1 );
)
);
// then make a data table from the associative array
dtWF = New Table( "wordfreq",
addrows( N Items( WordToFrequency ) ),
New Column( "word", character, values( WordToFrequency << getkeys ) ),
New Column( "freq", numeric, values( WordToFrequency << getvalues ) )
);
테이블은 단어별로 정렬됩니다.
There are currently 127K words. The blank one is a filler when there are <50 trends.There are currently 127K words. The blank one is a filler when there are <50 trends.There are currently 127K words. The blank one is a filler when there are <50 trends.There are currently 127K words. The blank one is a filler when there are <50 trends.현재 127,000개의 단어가 있습니다. 50개 미만의 추세가 있는 경우 빈 항목은 필러입니다.
첫 번째 흥미로운 질문은 "가장 유행하는 단어는 무엇입니까?"입니다. 빈도별로 정렬:
Caturday seems to be about cats.Caturday seems to be about cats.Caturday seems to be about cats.Caturday seems to be about cats.캐터데이는 고양이에 관한 것 같아요.
거기는. 토요일은 일주일 중 가장 인기가 없는 날입니다.
에서 언급했듯이 웹소켓 , 나는 이전에 이 데이터를 지루하게 시각화했습니다. 데이터는 도시(또는 미국 또는 세계)별이며 타임스탬프가 있습니다. 도움이 될 수 있는 Wikipedia의 뉴스 항목을 긁어내는 별도의 프로그램이 있습니다. 아마; 트위터 인기 단어는 (기껏해야) 실제 뉴스와 느슨하게 연결되어 있는 것처럼 보입니다.
(이 스크립트를 사용할 때 주의할 점: html과 xml 사이의 유사성을 남용하여 html을 JMP의 xml 리더가 처리할 수 있는 것으로 바꾸는 것입니다. 이 아이디어를 사용하기 전에 특정 HTML이 XML처럼 보이지 않는 이유를 파악하고 수정해야 합니다. 10행 주변의 정규식을 참조하세요. 이는 XML 판독기를 혼란스럽게 만드는 html 비트를 삭제하는 것입니다. 파이썬과 아름다운 수프를 사용하는 것이 더 쉬울 수도 있지만 나는 그렇게 하지 않았습니다.)
dtBig = New Table( "news",
New Column( "date", Numeric, "Continuous", Format( "yyyy-mm-dd", 12 ), Input Format( "yyyy-mm-dd" ) ),
New Column( "text", Character, "Unstructured Text" )
);
For( ddd = 1apr2023, ddd < Today(), ddd += In Days( 1 ),
url = "https://en.wikipedia.org/wiki/Portal:Current_events/" || Format( ddd, "Format Pattern", "<YYYY>_<MONTH>_<D>" );
txt = Load Text File( url );
Length( txt );
xml = Regex(
txt,
"|| |(<script.>)|(<FORM.>)|(<OPTION.>)|crossorigin|data-mw-ve-target-container|<LINK.>|<meta.>|<INPUT.>|<IMG.>",
"",
GLOBALREPLACE
);
dt = Open(
Char To Blob( xml ),
XML Settings(
Stack( 0 ),
Row( "/html/body/div/div/div/main/div/div/div/div/div/div/ul" ),
Row( "/html/body/div/div/div/main/div/div/div/div/div/div/ul/li/ul" ),
Row( "/html/body/div/div/div/main/div/div/div/div/div/div/ul/li/ul/li/ul" ),
Row( "/html/body/div/div/div/main/div/div/div/div/div/div/ul/li/ul/li/ul/li/ul" ),
Row( "/html/body/div/div/div/main/div/div/div/div/div/div/ul/li/ul/li/ul/li/ul/li/ul" ),
Col(
"/html/body/div/div/div/main/div/div/div/div/div/div/ul/li",
Column Name( "text" ),
Fill( "Use Once" ),
Type( "Original Text" ),
Format( {"Best"} ),
Modeling Type( "Continuous" )
),
Col(
"/html/body/div/div/div/main/div/div/div/div/div/div/ul/li/ul/li",
Column Name( "text" ),
Fill( "Use Once" ),
Type( "Original Text" ),
Format( {"Best"} ),
Modeling Type( "Continuous" )
),
Col(
"/html/body/div/div/div/main/div/div/div/div/div/div/ul/li/ul/li/ul/li",
Column Name( "text" ),
Fill( "Use Once" ),
Type( "Original Text" ),
Format( {"Best"} ),
Modeling Type( "Continuous" )
),
Col(
"/html/body/div/div/div/main/div/div/div/div/div/div/ul/li/ul/li/ul/li/ul/li",
Column Name( "text" ),
Fill( "Use Once" ),
Type( "Original Text" ),
Format( {"Best"} ),
Modeling Type( "Continuous" )
),
Col(
"/html/body/div/div/div/main/div/div/div/div/div/div/ul/li/ul/li/ul/li/ul/li/ul/li",
Column Name( "text" ),
Fill( "Use Once" ),
Type( "Original Text" ),
Format( {"Best"} ),
Modeling Type( "Continuous" )
),
),
XML Wizard( 0 )
);
For Each Row( dt, dt:text = Regex( dt:text, "<[^>]+>", "", GLOBALREPLACE ) );
dt << New Column( "date", Numeric, "Continuous", Format( "yyyy-mm-dd", 12 ), Input Format( "yyyy-mm-dd" ), <<SETEACHVALUE></SETEACHVALUE></IMG.></INPUT.></LINK.></OPTION.></FORM.></D></MONTH></YYYY>알겠습니다. 조사했습니다. 토요일 조금 더. 토요일과 연결될 수도 있습니다. 분석을 해보자. ...day로 끝나는 모든 트렌드 단어를 수집하고 그 일이 발생한 날짜를 기억해 보세요...
우와. 무리가 있습니다 (1568). 토요일과 토요일이 밀접하게 연관되어 있는 것 같습니다. 어쩌면 목요일이 실제로 가장 인기가 없을 수도 있습니다.
일요일로의 유출은 시간대 문제일 가능성이 높습니다.
어떤 아이디어라도 환영합니다... 읽어주셔서 감사합니다.