<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Случайное предложение из текста]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10575&amp;type=atom" />
	<updated>2015-04-13T05:32:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10575</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93295#p93295" />
			<content type="html"><![CDATA[<p>Поменять<br /></p><div class="codebox"><pre><code>   MsgBox % sentence</code></pre></div><p>на<br /></p><div class="codebox"><pre><code>sentences .= sentence &quot;`n&quot;</code></pre></div><p>И потом использовать команду Sort либо Random.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-13T05:32:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93295#p93295</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93287#p93287" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Так наверное можно</p></blockquote></div><p>Да, так получается, только вот предложения не в рандомном порядке</p>]]></content>
			<author>
				<name><![CDATA[Stukk]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32996</uri>
			</author>
			<updated>2015-04-12T08:17:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93287#p93287</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93285#p93285" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alectric пишет:</cite><blockquote><p>Про &quot;RegExMatch&quot; и &quot;RegExReplace&quot; читай в английской справке.</p></blockquote></div><p>Они и в переводе есть.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-04-12T04:50:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93285#p93285</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93284#p93284" />
			<content type="html"><![CDATA[<p>Так наверное можно:<br /></p><div class="codebox"><pre><code>text=
(
Спасибо большое за пример. Можно ли выделять предложения по принципу &quot;от точки до точки&quot;? То есть в буфер, например, вставляются все символы от какой-то рандомной точки до первой встретившейся?
)
Pos := 1
While Pos := RegExMatch(text,&quot;[&quot;&quot;\(А-ЯA-Z0-9].*?[\.\?\!]+&quot;,sentence,Pos+StrLen(sentence))
   MsgBox % sentence</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-04-12T04:29:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93284#p93284</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93283#p93283" />
			<content type="html"><![CDATA[<p>Про &quot;regex&quot; сам еще не до конца понимаю. Каждый раз вчитываюсь в <a href="http://www.script-coding.com/AutoHotkeyTranslation.html">справку</a>. Про &quot;RegExMatch&quot; и &quot;RegExReplace&quot; читай в английской справке.</p><p>Вот &quot;костыльный&quot; вариант, как смог - так и написал:<br /></p><div class="codebox"><pre><code>str=
(
.
Ла лала ла л ал. Лаалала лал лалала?
Бу буб убббубуб ббу! Лалал бу, блал бла.
)

while (str!=&quot;&quot;)
{
  Pos:=RegExMatch(str,&quot;(.*[\.\?!\R])(.*[\.\?!\R])&quot;,var)
  if !pos
    break
  arr%a_index%:=regexreplace(var2,&quot;\R&quot;)
  str:=var1
  count:=a_index
;  tooltip,% var1 &quot;`n`n&quot; var2 &quot;`n&quot; Pos
}


loop,% count
  msgbox,% arr%a_index%



Random,N,1,%count%
msgbox,% &quot;Случайное:`n&quot; N &quot;/&quot; count &quot;`n`n&quot; arr%N%
</code></pre></div><p>Присутствует два &quot;бага&quot;: это точка в начале и обратная последовательность предложений.</p><p>Что касается сокращений в тексте: нужно составлять список сокращений и заменять в них точки на &quot;спецсимволы&quot;, затем восстанавливать в точки.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-04-12T04:01:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93283#p93283</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93277#p93277" />
			<content type="html"><![CDATA[<p>А можете подробнее рассказать о команде &quot;regex&quot;?</p>]]></content>
			<author>
				<name><![CDATA[Stukk]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32996</uri>
			</author>
			<updated>2015-04-11T18:58:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93277#p93277</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93276#p93276" />
			<content type="html"><![CDATA[<p>Смотря какой исходный текст. В литературных произведениях точки в основном в конце предложений.</p>]]></content>
			<author>
				<name><![CDATA[Stukk]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32996</uri>
			</author>
			<updated>2015-04-11T18:57:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93276#p93276</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93275#p93275" />
			<content type="html"><![CDATA[<p>От точки до точки скорее всего не получится, в середине предложения могут быть многоточия и сокращения.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-04-11T18:55:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93275#p93275</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93273#p93273" />
			<content type="html"><![CDATA[<p>Действительно. Тогда &quot;regex&nbsp; [.!?]&quot;.</p><p>П.с. не могу написать корректный код с телефона, извините.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-04-11T18:44:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93273#p93273</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93272#p93272" />
			<content type="html"><![CDATA[<p>Спасибо большое за пример. Можно ли выделять предложения по принципу &quot;от точки до точки&quot;? То есть в буфер, например, вставляются все символы от какой-то рандомной точки до первой встретившейся?</p>]]></content>
			<author>
				<name><![CDATA[Stukk]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32996</uri>
			</author>
			<updated>2015-04-11T18:42:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93272#p93272</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93271#p93271" />
			<content type="html"><![CDATA[<p>А что, предложения оканчиваются только точками?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-04-11T18:41:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93271#p93271</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93270#p93270" />
			<content type="html"><![CDATA[<p>От точки до точки - предложения. Но как определить первое это надо думать.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-04-11T18:40:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93270#p93270</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93265#p93265" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>str =
(
Документация по программе AutoHotkey
Введение
Общий обзор программы и краткое обучение 
Туториал - Запуск программы или документа (продолжение)  
Часто задаваемые вопросы (FAQ)
Горячие клавиши для мыши, джойстика и клавиатуры 
Создание клавиатурной макрокоманды или макрокоманды мыши
Потоки
Замещение и блокировка горячих клавиш
Строки автозамены
Переназначение клавиш и кнопок мыши
Список клавиш и кнопок мыши/джойстика
Скрипты
Переменные и выражения
)
oRow := StrSplit(str, &quot;`n&quot;)
Loop  {
    Random, r, 1, oRow.MaxIndex()
    MsgBox % oRow[r]
}</code></pre></div><p>Со строками очень просто. Но вот каким признакам разбивать гарантированно разбивать текст на предложения, я не знаю.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-04-11T18:28:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93265#p93265</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93259#p93259" />
			<content type="html"><![CDATA[<p>Можете привести пример, если это не трудно?</p>]]></content>
			<author>
				<name><![CDATA[Stukk]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32996</uri>
			</author>
			<updated>2015-04-11T18:15:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93259#p93259</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Случайное предложение из текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=93258#p93258" />
			<content type="html"><![CDATA[<p>Да возможен.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-04-11T18:14:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=93258#p93258</id>
		</entry>
</feed>
