word

How to count all the words in a textfile with multiple space characters

无人久伴 提交于 2021-02-17 04:40:48
问题 I am trying to write a procedure that counts all the words in a text file in Pascal. I want it to handle multiple space characters, but I have no idea how to do it. I tried adding a boolean function Space to determine whether a character is a space and then do while not eof(file) do begin read(file,char); words:=words+1; if Space(char) then while Space(char) do words:=words; but that doesnt work, and basically just sums up my(probably bad) idea about how the procedure should look like. Any

How to count all the words in a textfile with multiple space characters

青春壹個敷衍的年華 提交于 2021-02-17 04:40:36
问题 I am trying to write a procedure that counts all the words in a text file in Pascal. I want it to handle multiple space characters, but I have no idea how to do it. I tried adding a boolean function Space to determine whether a character is a space and then do while not eof(file) do begin read(file,char); words:=words+1; if Space(char) then while Space(char) do words:=words; but that doesnt work, and basically just sums up my(probably bad) idea about how the procedure should look like. Any

Microsoft Word 通过通配符替换图片下标文字

限于喜欢 提交于 2021-02-12 11:57:06
今天在评审文档时,要求统一图片下标文字的格式,现举个例子说明使用通配符对文本进行替换的方法。 我的Windows版本是Win7旗舰版(Service Pack 2),Office版本是 Microsoft Office 2010 1、现有一篇Word文档内容如下,所有的图片编号都被写为“(图X.X.X)”,现计划改为“【图X.X.X】”。 2、按下Ctrl+H进入“查找和替换”界面。在搜索选项中勾选“使用通配符”。查找内容输入“(图([0-9]@).([0-9]@).([0-9]@))”,替换的内容输入“【图\1.\2.\3】”。点击“全部替换”对文本进行替换。 3、Word提示当前已对文档搜索并已完成8处替换。替换完毕。 这个功能也可以通过VBA宏来一键解决: Sub 更改图片下标格式() ' ' 更改图片下标格式 宏 ' ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(图([0-9]@).([0-9]@).([0-9]@))" .Replacement.Text = "【图\1.\2.\3】" .Forward = True .Wrap = wdFindContinue .Format = False

how to specify random_state in LDA model for topic modelling

大城市里の小女人 提交于 2021-02-11 15:10:31
问题 I read the gensim LDA model documentation about random_state which states that: random_state ({np.random.RandomState, int}, optional) – Either a randomState object or a seed to generate one. Useful for reproducibility. I have been tring put random_state=42 or random_seed=42 state=np.random.RandomState(random_seed) state.randn(1) random_state=state.randn(1) which did not work. Can anyone suggest what should i do model=ldaModel(corpus=corpus, id2word=dictionary, num_topics=num_topics, random

word count from web text document result in 0

邮差的信 提交于 2021-02-10 18:14:13
问题 I tried the python codes from the article of Rasha Ashraf "Scraping EDGAR with Python". He used urllib2 which is now invalid in python 3, I guess. Thus, I changed it into urllib. I could bring the following Edgar web page. However, the number of word counting resulted in 0 no matter how I tried to fix the codes. Please help me to fix this problem. FYI, I manually check on the URL page so that "ADDRESS", "TYPE", and "transaction" occur 5 times, 9 times, and 49 times each. Nevertheless, my

Sentinel issue with loop to allow to enter quit to end program in java

こ雲淡風輕ζ 提交于 2021-02-05 10:46:12
问题 I'm having trouble at the bottom part where i am trying to set the sentinel exit key to quit.. im not sure exactly how i am supposed to do it. int number; do { Scanner Input = new Scanner(System.in); System.out.print("Enter a positive integer or q to quit program:"); number = Input.nextInt(); } while(number >= 0); do { Scanner Input = new Scanner(System.in); System.out.print("Input should be positve:"); number = Input.nextInt(); } while(number < 0); do { Scanner quit = new Scanner(System.in);

“This command is not available.” error occurs when trying to execute PasteAndFormat function

孤街醉人 提交于 2021-01-28 04:10:47
问题 I published the VSTO app, where I copy a Range with a formatted text. On most users machines the application works properly while some users have the error "This command is not available." thrown whenever the following piece of code is being excetuded. var sourceDocument = Globals.ThisAddIn.Application.ActiveDocument; sourceDocument.Range().Copy(); Document documentOld = new Document(); documentOld.Range().PasteAndFormat(WdRecoveryType.wdFormatOriginalFormatting); //here the error occurs

I want to highlight a word if it is not followed by another specific word using VB

无人久伴 提交于 2020-12-15 05:35:22
问题 So I'm a total newbie when it comes to using VB. I am trying to highlight a word when it is not followed by another specific word within the next two words. I tried the following code but it seems to just the first word. Many thanks in advance. Sub fek() ' ' ' ' Selection.Find.ClearFormatting With Selection.Find .Text = "n." .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = True .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms =

I want to highlight a word if it is not followed by another specific word using VB

橙三吉。 提交于 2020-12-15 05:35:12
问题 So I'm a total newbie when it comes to using VB. I am trying to highlight a word when it is not followed by another specific word within the next two words. I tried the following code but it seems to just the first word. Many thanks in advance. Sub fek() ' ' ' ' Selection.Find.ClearFormatting With Selection.Find .Text = "n." .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = True .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms =

arnold/book cipher with python

喜夏-厌秋 提交于 2020-11-28 09:08:00
问题 I'm trying to write a book cipher decoder, and the following is what i got so far. code = open("code.txt", "r").read() my_book = open("book.txt", "r").read() book = my_book.txt code_line = 0 while code_line < 6 : sl = code.split('\n')[code_line]+'\n' paragraph_num = sl.split(' ')[0] line_num = sl.split(' ')[1] word_num = sl.split(' ')[2] x = x+1 the loop changes the following variables: paragraph line word and every thing is working just fine . but what I need now is how to specify the