AIM-291-Weizenbaum

---------+---------+---------+---------+---------+---------+---------+---------+

 

A RESPONSE TO JOHN McCARTHY
by
JOSEPH WEIZENBAUM

 

Whatever the merit of John McCarthy's review of Computer Power and Human Reason may be, it is all but undone by his repeated assertion that the positions taken in the boom are derived from a "new left" political ideology. Not long ago the terms "pinko" or "commie" serve the function McCarthy assigns to "new left" in his review. I would have thought, but for this exhibit, that even people with as limited a sense of history as John McCarthy displays in his review might have learned something from the events of the tragic decades the United States has just passed through. I would have thought, but for this exhibit, that all participants in scholarly debates had by now renounced argument by irrelevant political association.

John McCarthy が "Computer Power and Human Reason" をレビューしたことのメリットが何であれ、ブームでのポジションは「新左翼(new left)」の政治イデオロギーに由来しているという主張を繰り返すことですべて取り消されています。まもなく、"pinoko" または "commie" という用語は、McCarthy がレビューで「新左翼」に割り当てる機能に役立ちます。私は考えていましたが、今回の展覧会では、 John McCarthy のような歴史的感覚が限られている人でさえ、米国が今や通過した悲劇的な出来事から何かを学んだかもしれないと思うでしょう。私は思ったのですが、この展覧会では、学者の議論に参加したすべての参加者が、無関係な政治的な関係によって議論を放棄していたことが分かりました。

 

McCarthy's warning to "the outside observer" that the book is motivated by a struggle over academic appointments, tenure decisions, etc. going on within M.I.T. is bizarre and absurd. It is another blot on the review and, I would say, on its author. Such tactics are simply indecent.

McCarthy の「外部観察者」への警告は、本書が M.I.T. の中で行われている学術的任命、在籍決定などの闘争によって動機付けされていることを示しています。奇妙で不条理です。それはレビューのもう一つの点であり、私はその著者について言います。そのような戦術は単にいかがわしいです。

 

I am disturbed by John McCarthy's misreading of my book's ”main points." The books actual main point, to the extent that there is one main point, is that no single way of seeing the world, whether it he that of the computer metaphor, of science, of religion, or some political dogma, or of whatever, is sufficient to yield an understanding of the world worthy of the human potential to understand.

私は、 John McCarthy が私の本の「要点」を誤読しているのを嫌っています。本の要点は、一つの要点がある限り、コンピュータのメタファーの世界であろうと、科学、宗教、政治的ドグマなど、人間が理解できる可能性のある世界を理解するのに十分です。

 

McCarthy sees the book making the following main points:

McCarthy は、この本を次のような要点として見ています。

 

1) COMPUTER CANNOT BE MADE TO RESION AS POWERFULLY AS HUMANS

1) コンピュータは人間に強く共鳴することはできない
I wrote: "...I see no way to put a bound on the degree of intelligence [a computer] could, at least in principle, attain." (p.210) I then go on to argue that a computer's socialization, that is, its acquisition of knowledge from its experience with the world, must necessarily be different from the socialization of human beings. computer's intelligence must therefore be always alien to human intelligence with respect to a certain range of human affairs. (p. 213) Nowhere do I limit the computer’s "reasoning power." The whole been is, however, an attack on the dogmatic coupling of reason to power. This coupling is so much part of the Zeitgeist that single-mindedly committed technological enthusiasts simply cannot conceive of a discussion of reason - whether by computers or not - that is not at the same time centered on questions of power. McCarthy's gratuitous projection of his own preoccupations unto me in the form of his attribution to me of this "main point" is further evidence for that.

"...私は知性の程度に限界を置く方法を見ない。少なくともコンピュータは、少なくとも原理的には達成することができる。"と私は書きました。(p.210)次に、コンピュータの社会化、つまり世界との経験から得た知識の獲得は、必然的に人間の社会化とは異なるものでなければならないと主張します。したがって、コンピュータの知性は、ある種の人間関係に関して常に人間の知能とは異質でなければなりません。(p. 213)コンピュータの「推論力」を制限することはどこでもできません。しかし、全体としては、権力主義のドグマのような組み合わせに対する攻撃です。この組み合わせは、精神的にコミットされた技術愛好家が、単にコンピュータによるか否かにかかわらず、同時に力の問題を中心にしていない理由の議論を考えることができないというZeitgeist時代精神)の大部分です。マッカーシーの根拠のない投影(この「主なポイント」の私への帰属の形で彼自身の私に対する先入観)が、その証拠です。

 

2) THERE ARE TASKS THAT COMPUTERS SHOULD NOT BE PROGRAMMED TO DO.

2) コンピュータが実行するようにプログラムされるべきではないというタスクがある
Yes, that is genuinely a main point of the book. And McCarthy is right in observing that task that should not be done at all should not be done by computers either. McCarthy and I agree that psychotherapy should under some circumstances be practiced. I am opposed to machine administered psychotherapy and McCarthy cannot see what objections there right be to it (other than those that arise from "new left" motivations) if it were to "cure" people. Prefrontal lobotomy "cures" certain mental disorders. But at what price to the patient and, I would add, to the surgeon as well? I believe that machine administered psychotherapy would induce an image of what it means to be human that would be prohibitively costly to human culture. One may disagree with this belief. But one would first have to understand it and to take it into account.

はい、それが真に本書の要点です。そして、McCarthyは、まったくやってはいけないタスクをコンピュータで行うべきではないことも観察しています。McCarthyと私は、ある状況下では心理療法が実践されるべきだということに同意します。私は機械を用いた心理療法に反対しており、McCarthyは人々を「治療する」ためには、そこに(「新左翼」の動機から生じるもの以外の)どんな反対があるのか​​を知ることはできません。前頭葉切開術(ロボトミー)は特定の精神障害を "治療"します。しかし、患者にとってどんな価格であったとしても、その上、私が外科医を追加すると思いますか?機械によって管理された心理療法は、人間文化にはコストがかかりすぎるであることを想起させるイメージを誘発するだろうと私は信じています。この信念に同意しない人もいるかもしれません。しかし、まずそれを理解し、それを考慮する必要があります。

 

Elsewhere I say that an individual is dehumanized whenever he treated as less than a whole person. The relevance of that to the present discussion can be seen if one recalls how inhumanely many surgeons treat their patients and people generally. They have, after many years of seeing their patients mainly as objects to be cut and sewed, cone to see then as nothing more than objects. Many surgeons eventually see everyone, most importantly themselves, in this narrow way. Similar remarks apply to other professions. It is of course necessary for all of us to adopt an effective clinical attitude toward people we deal with in a large variety of situations. The surgeon could not actually out into living flesh were he not able to impose a psychological distance between himself and his patient while actually wielding the scalpel. But somewhere in his inner being he should hold on to his perception of his patient as a whole person. Even more importantly, the patient must never be led into a situation in which he is forced, or even merely encouraged, to regard himself as a mere object. By fear is that computer administered psychotherapy necessarily induces just this kind or self-image in the patients who would be subject to it. That, basically, is my objection ‘to it. I cannot see how such a system could "cure" people in any reasonable sense of the word "cure", that is, in a sufficiently encompassing interpretation of that word.

他の場所では、個人が人間全体よりも少なく扱うたびに、人間は非人間化されていると言いました。この議論との関連性は、非人道的に多くの外科医が患者や一般人をどのように扱うのかを想起すれば分かるはずです。彼らは、何年もの間、患者を主に切断して縫うべき物体として見ています。多くの外科医は結局、この狭い方法ですべての人、最も重要なのは自分自身を見ます。同様の発言は他の職業にも当てはまります。もちろん、私たち全員が多種多様な状況で対処する人に対して効果的な臨床的態度をとる必要があります。外科医は実際に生きている肉に出くわすことはできませんでした。それは、実際にメスを使用している間に、彼と彼の患者の間に心理的な距離を課すことができなかったからです。しかし、彼の内面のどこかで、彼は患者全体に対する彼の認識を保持するべきです。さらに重要なのは、患者を自分自身を単なる物体と見なすよう強制される、あるいは単に励ますような状況に患者を導くことは決してあってはならないでしょう。心配することは、コンピュータによって管理される精神療法は、必然的に被験者にこの種のまたは自己イメージを誘発することです。それが私が基本的に反対する事です。どのようにそのようなシステムが「治癒」という言葉の合理的な意味で、つまりその言葉の十分に包括的な解釈で人々を「治す」ことができないのか分かりません。

 

3) SCIENCE HAS LED PEOPLE TO A WRONG VIEW OF THE WORLD AND LIFE.

3) 科学は、世界人類の間違った見方に人々を誘導している
There is no "correct" or "wrong" view of life to which science or anything else can lead. The point McCarthy here misconstrues is that science, or any other system or thought, leads to an impoverished view of the world and of life when it or any system is taken to be the only legitimate perspective on the world and on life.

科学や他のものが導くことができる「正しい」または「間違った」人生の見解はありません。ここでマッカシーが誤解している点は、科学や他のシステム、思考が、世界と人生の唯一の正当な視点であるとみなされるときに、世界と人生の貧困な見方につながるということです。

 

4) SCIENCE IS NOT THE SOLE ON EVEN THE MAIN SOURCE OF KNOWLEDGE.

4) 科学は知識の主要な源であっても唯一のものではない
How reliable would McCarthy say is his knowledge that his children are biologically his children or that the person he knows as his Father is his biological father? Is science his source of such knowledge? what proportion of the truly important actions McCarthy has taken in the course of his adult life were predicated solely or even vainly on knowledge he validated by appeals to science? Did the ancients have reliable knowledge? Or have we had reliable knowledge only since the founding of the British Royal Society - or that of the Stanford AI Lab - or not yet at all?

自分の子供が生物学的に彼の子供であるという彼の知識、あるいは彼の父親が彼の生物学的な父親であると知っている人をMcCarthy はどれほど信頼できますか?科学はそのような知識の源泉ですか?McCarthy が大人の生活の中で取った本当に重要な行動のうち、彼が科学への訴えによって立証された知識に専念するか、あるいは無益であると主張されていますか?古代人は信頼できる知識を持っていましたか?あるいは、英国王立協会(スタンフォードAIラボでも良いです)の設立以来、私たちは信頼できる知識を持っていたのですか?それともまだなのでしょうか?


5) CERTAIN PEOPLE AND INSTITUTIONS ARE BAD.

5) 特定の人と組織は悪い
I know of very few people I would call "bad" - Hitler and Himmler are examples. I think some of the people McCarthy lists are often wrong and sometimes behave irresponsibly especially when they speak to and write for lay audiences. There appears to be wide agreement on that within the AI community itself. I think the views expressed by some of the people mentioned are dangerous. These views should be discussed, not suppressed. My book contributes to the required discussion. Some people will surely find my views wrong and perhaps even dangerous. If they think my views worthy of more than contempt, they should discuss them. Does McCarthy think I am "bad?" I don't believe so. why then should he believe I think the people he mentions are bad?

私が「悪い」と呼ぶ人はほとんどいないです。ヒットラーヒムラーは例外です。McCarthy のリストの中には、しばしば間違っている人がいると私は思うし、そのような人は特に聴衆に話したり書き込んだりするときに無責任な行動を取ることもあります。AIコミュニティ自体の中でもそれに幅広く合意しているようです。言及された人々のいくつかによって表現された意見は危険だと私は思います。これらの意見は、抑止されるものではなく議論されるべきでしょう。私の本は必要な議論に貢献します。幾らかの人たちにとっては私の見解は確かに間違っているかもしれないし、おそらく危険でさえあるでしょう。彼らが私の見解を軽蔑以上の価値があると考えるなら、彼らはそれらについて話し合うべきです。マッカーシーは私が「悪い」と思いますか?私はそう信じていません。彼が言及した人々が何故悪いと彼は思いますか?

 

The Department of "Defense" is, in my view, on the whole bad. And the quotation marks are, I would guess, entirely appropriate in the eyes of most of the people of the world -- especially in the eyes of many who have read Orwell. If the emperor wears no clothes, we should say he wears no clothes.

私の見解では「国防総省」は全体として悪いです。私が推測するように、引用符は、世界のほとんどの人の目に、特にオーウェルを読んだ多くの人の目には完全に適切です。皇帝が服を着ていなければ、服を着ていないと言うべきです。


Other remarks:

その他の発言: 

I do not say and I do not believe that "if the problem hasn't been solved in twenty years, we should give up." I say (p. 198) "... it would be wrong ... to make impossibility arguments about what computers can do entirely on the grounds of our present ignorance." That is quite the Opposite of what McCarthy charges he with saying.

「問題が20年後に解決されなければ、私たちはあきらめるべきだ」などと私は言ってないし、信じてもいません。"コンピュータが現在の無知の理由で完全に何ができるかについて不可能な主張をすることはは間違っている"と言いました。マッカーシーが彼に言いつけたこととはかなり反対です。

 

I do not say or imply that "the Defense Department supports speech recognition research in order to be able to snoop on telephone conversations." Attributing this view to me is, in McCarthy's words, "tiased, baseless, false, and [seemingly] motivated by malice." I wrote: "this project then represents, in the eyes of its chief sponsor, a long step toward a fully automated battlefield." I then state my opinion that, should we get speech recognition, large organizations such as the government would use it for snooping, etc. I believe that. my belief is buttressed by the revelations (F.Y.I., August 31 1973) that the "NSA eavesdrops on virtually all cable, Telex and other non-telephone communications leaving the U.S. and uses computers to sort and obtain intelligence from the contents ..." (emphasis nine). Clearly the exclusion of telephone communications from this operation is a consequence of only technical limitations that would be removed if we has automatic speech recognition systems.

私は「国防総省は、電話会話を盗聴できるようにするために、音声認識の研究をサポートしている」と発言したり、暗示したりしていません。McCarthyの言葉では、この見解は私には「偏見があり、根拠がなく、虚偽で、悪意のある人によって動機付けされている」と書かれています。私は「このプロジェクトでは、主任スポンサーの目の前で、完全に自動化された戦場に向けての長い歩みを表している」と書きました。それから、音声認識が必要な場合は、政府などの大規模な組織がスヌーピングなどに使用するという私の意見を述べます。私は信じています。私は、「NSAは、実質的にすべてのケーブル、テレックス、米国以外の非電話通信を盗み、コンピュータを使って内容から情報を分類して入手する」という暴露(F.Y.I.、1973年8月31日)を確信しています。(強調9)明らかに、この操作から電話通信を除外することは、自動音声認識システムがあれば除去される技術的限界の結果に過ぎないでしょう。

 

The reference cite: in note 9, page 286, is anonymous because the person in question granted we permission to quote from his internal memorandum on the condition that I not cite his name. It is not nice of John McCartny to press me to violate my word.

引用文献:286頁9頁に記載されている匿名は、私が彼の名前を引用していないという条件で彼の内部覚書を引用する許可を認めているため、匿名です。私の言葉に違反するように私を押さえるのは、John McCartny にとってすばらしいことではないでしょう。

 

I do not "idealize the life of primitive man." it is a cheap shot often practiced by technological enthusiasts to charge anyone who mentions a loss entailed by man's commitment to technology (and there surely have been and are losses) with advocating a return to pretechnological times. Every modern writer I know of knows that there cannot have been a pretechnological time in the history or what we would call man, and that history cannot be reversed. But it is important that we recognize and understand the costs associated with our current commitment to technology and that we seek for ways to reduce the costs at seem too nigh. There is nothing anti-technological, anti-scientific, or anti-intellectual in that.

私は「昔の人の人生を理想化」しません。技術愛好者がしばしば安価なショットをして、技術的な時代への復帰を主張して、技術への人間のコミットメントに伴う損失を言及している(そして、確かに失われており、失われている)私が知っている現代のすべての作家は、歴史上、あるいは私たちが人と呼ぶもののうちに先行技術的な時間はなかったことがあり、その歴史は逆転できないことを知っています。しかし、現在の技術へのコミットメントに関連するコストを認識し理解することが重要であり、コスト削減の方法を模索しているようにも思えます。反技術的、反科学的、反知的なことは何もありません。

 

McCarthy suggests that my statement "Those who know who and what they are so not need to ask what they should do" is ”menacing" in that he believes it to require a priesthood to apply it to a particular case. The statement appears in a context (p.273) in which I had just alludes to the fact that people are constantly asking exports what they should do. I don't believe people need "expert" guidance on moral questions. The statement, on its very face, argues that no priesthood is ever necessary to tell people what they must do. I find McCarthy's exact opposite analysis extremely puzzling.

McCarthy は、私の「誰が何をすべきかを知っている人たちは、何をすべきかを尋ねる必要はない」という声明が、特定の事例にそれを適用するために神権が必要と考えている点で「脅迫的」であると示唆しています。コンテキスト(p.273)は、人々が絶えず輸出に何をすべきかを尋ねているという事実をほのめかしたものであり、私は人々が道徳的な疑問について「専門家」の指導を必要としているとは信じていません。私はMcCarthy の正反対の分析が非常に困惑していることを知っています。

 

My assertion that "An individual is dehumanized whenever he is treated as less than a whole person" is singly a statement of fact. It is incomprehensible to me that shame or guilt tall or me because McCarthy believes similar statements to he part of the catechism at the "encounter group movement," about which, by the way, I know next to nothing.

 

Does John McCarthy have a logical calculus with which he has proved that any idea held by the new left or the encounter group movement or by numford, Roszak, or allul is wrong, a enace, and certain to do used as part or the arsenal or "priests [who] quickly crystallize around any potential center or power?" (here again we see evidence of McCarthy's preoccupation with power.)

 

Finally, McCarthy asserts "Philosophical and moral thinking has never found a model of man that relates human beliefs to the physical world in a plausible way.” Only someone who has mastered the entire philosophical and moral literature could have the authority to say that. what truly God-like humility! The distance that separates John McCarthy from Joseph Weizenbaum is truly measured by the challenges these two hurl at one another: McCarthy defies Weizenbaum to ”Show me a way to knowledge besides science!" And Weizenbaum responds: “Can there be a way toward an authentic model of man that does not include and ultimately rest on philosophical and moral thinking?"

 

No wonder we talk past one another.

---------+---------+---------+---------+---------+---------+---------+---------+

 

AIM-291-McCarthy

これは "Three Reviews of J. Weizenbaum’s COMPUTER POWER AND HUMAN REASON" に収録されている John Mccarthy の "AN UNREASONABLE BOOK" の全文です。

http://www.dtic.mil/dtic/tr/fulltext/u2/a044713.pdf

 

この文章は彼のホームページにも掲載されています。

jmc.stanford.edu

が、修正が施されているようです。

 

人工知能」という名前の発案者であり LISP の発明者でもあった McCarthy は、この研究分野の積極派でした。故に人工知能研究に対して慎重な姿勢を示すWeizenbaum の著作には辛辣な批判を行なっています。

 

---------+---------+---------+---------+---------+---------+---------+---------+

The following review appeared in Creative Computer and in the SIGART News Letter.

次のレビューはCreative ComputerとSIGART News Letterに掲載されました。

 

AN UNREASONABLE BOOK

不合理な本

 

Joseph Weizenbaum, Computer Power and Human Reason, W.H. Freeman Co., San Francisco 1975

 

This moralistic and incoherent book uses computer science and technology as an illustration to support the view promoted by Lewis Mumford, Theodore Roszak, and Jacques Ellul, that science has led to an immoral view of man and the world. I am frightened by its arguments that certain research should not be done if it is based on or might result in an "obscene" picture of the world and man. Worse yet , the book’s notion of "obscenity" is vague enough to admit arbitrary interpretations by activist bureaucrats.

この道徳的で矛盾した本は、コンピュータ科学と技術を、ルイス・マンフォード、セオドア・ローザック、ジャック・エリュールの「科学は人間と世界を不道徳な視点に導いている」との見解を支持する実例として使用しています。私は、それが世界と人間の「猥褻な」像に基づいている、あるいはその結果になる可能性がある特定の研究が行われるべきではないという主張を恐れています。さらに悪いことに、この本の「節度を欠いた」という概念は、活動家の官僚による恣意的な解釈を認めるにはあいまいです。

 

 

1. IT’S HARD TO FIGURE OUT WHAT HE REALLY BELIEVES

1. 彼が本当に信じていることを説明するのは難しい

 

Weizenbaum’s style involves making extreme statements which are later qualified by contradictory statements. Therefore, almost any quotation is out of context, making it difficult to summarize his contentions accurately.

Weizenbaumのスタイルは、あとで矛盾したステートメントで修飾された極端なステートメントを作成することを伴います。したがって、ほとんどの引用は文脈から外れており、彼の競合を正確に要約することは困難です。 

 

The following passages illustrate the difficulty:

以下の文章は難易度を示しています:

 

“In 1935, Michael Polanyi”, [British chemist and philosopher of science , was told by] “Nicolai Bukharin, one of the leading theoreticians of the Russian Communist party, ... [that] ‘under socialism the conception of science pursued for its own sake would disappear, for the interests of scientists would spontaneously turn to the problems of the current Five Year Plan.’ Polanyi sensed then that ‘the scientific outlook appeared to have produced a mechanical conception of man and history in which there was no place for science itself.’ And further that ‘this conception denied altogether any intrinsic power to thought and thus denied any grounds for claiming freedom of thought!” -- from page 1. Well, that ’s clear enough; Weizenbaum favors freedom of thought and science and is worried about threats to them. But on page 265, we have

ロシア共産党の有力な理論家の一人であるニコライ・ブカリン(Nicolai Bukharin)は、「社会主義の下で、科学の構想が追求された」と語ったのは、1935年にマイケル・ポラニー(Michael Polanyi)[科学の英国化学者と哲学者]科学者たちの利益が自発的に現在の5カ年計画の問題に変わることになるからである」ポーラニーは、「科学的な見通しは、人と歴史の機械的概念を生み出したようであるさらに、「この構想は、思考の本質的な力を完全に否定し、思考の自由を主張する根拠を否定した」と述べた。 - 1ページ目から。 Weizenbaumは思考や科学の自由を好んでおり、彼らに対する脅威を心配しています。しかし、265ページには、

 

“Scientists who continue to prattle on about ‘knowledge for its own sake’ in order to exploit that slogan for their self—serving ends have detached science and knowledge from any contact with the real world”. Here Weizenbaum seems to be against pure science, i.e. research motivated solely by curiosity. We also have

「自己目的のためにそのスローガンを利用するために、「自分のための知識」を賭け続けている科学者は、現実世界との接触から科学と知識を切り離している」ここでWeizenbaumは純粋な科学、すなわち好奇心だけによって動機付けられた研究に反対しているようです。我々はまた

 

“With few exceptions, there have been no results, from over twenty years of artificial intelligence research, that have found their way into industry generally or into the computer industry in particular.” - page 229 This again suggests that industrial results are necessary to validate science.

「わずかな例外を除いて、20年以上の人工知能研究の結果、業界全体または特にコンピュータ業界に影響を与えている結果は得られていませんでした。」 - ページ229 これは、工業的結果が科学を検証するために必要であることを再び示唆しています。

 

“Science promised, man power. But as so often happens when people are seduced by promises of power -- the price actually paid is servitude and impotence”. This is from the book jacket. Presumably the publisher regards it as a good summary of the book’s main point.
"科学は、人間の力を約束した。しかし、人々が権力の約束によって誘惑されたときにそう頻繁に起こります - 実際に支払われる価格は兵役とインポテンスです。 "これは本ジャケットからのものです。おそらく、出版社はそれを本の要点の良い要約と見なしていると思われます。

 

“I will, in what follows, try to maintain the position that there is nothing wrong with viewing man as an information processor (or indeed as anything else) nor with attempting to understand him from that perspective, providing, however, that we never act as though any single perspective can comprehend the whole man.” - page 140. We can certainly live with that, but

「私は次のように、あたかも一人のパースペクティブが全人類を理解できるかのように、人間を情報プロセッサとして(あるいは何か他のものとして)見ても何の問題もないという立場を維持しようとはしません」 - 140ページ。確かにそれで生きることができますが、

 

“Not only has our unbounded feeding on science caused us to become dependent on it, but, as happens with many other drugs taken in increasing dosages, science has been gradually converted into a slow acting poison”. - page 13. These are qualified by

「科学への無限の餌付けは、私たちにそれに依存するようになっただけでなく、他の多くの薬物が増量されて起こるように、科学はゆっくりと作用する毒に徐々に変換されてきました」 - ページ13。これらは以下によって修飾されています。

 

“I argue for the rational use of science and technology , not for its mystification, let alone its abandonment ”, - page 256

「私は科学技術の合理的な利用を主張しているが、その放棄はもちろんのこと、その神秘についてではないのです」- ページ 256。

 

In reference to the proposal for a moratorium on certain experiments with recombinant DNA because they might be dangerous, we have “Theirs is certainly a step in the right direction, and their initiative is to be app lauded. Still, one may ask , why do they feel they have to give a reason for what they recommend at all? Is not the overriding obligation on men, including men of science, to exempt life itself from the madness of treating everything as an object, a sufficient reason, and one that does not even have to be spoken? Why does it have to be explained? It would appear that even the noblest acts of the most well—meaning people are poisoned by the corrosive climate of values of our time. ”Is Weizenbaum against all experimental biology or even all experiments with DNA? I would hesitate to conclude so from this quote; he may say the direct opposite somewhere else. Weizenbaum’s goal of getting lines of research abandoned without even having to give a reason seems unlikely to be achieved except in an atmosphere that combines public hysteria and bureaucratic power. This has happened under conditions of religious enthusiasm and in Nazi Germany, in Stalinist Russia and in the China of the “Cultural Revolution”. Most likely it won’t happen in America.

組換えDNAを用いたある種の実験では危険である可能性があるため、モラトリアムの提案に関して、「彼らは確かに正しい方向への一歩であり、彼らのイニシアチブは賞賛される」ことになっています。それでも、彼らはなぜ彼らは彼らがまったく何を勧める理由を与えなければならないと感じるのでしょうか?科学者を含む男性の最優先義務は、すべてを目的、十分な理由、話さなくてもよいものとして扱うという狂気から生命を免除することではないでしょうか?なぜそれを説明する必要があるのでしょうか?最も意義深い人々の最も尊敬されない行為でさえ、私たちの時代の価値観の腐敗的な風潮によって中毒されるように見えるでしょう。Weizenbaumはすべての実験生物学、あるいはDNAを用いたすべての実験にも対抗しているのでしょうか?私はこの引用文からそうすることを躊躇します。彼は他のどこかの反対側を言うかもしれない。Weizenbaumの目的は、公共のヒステリーと官僚的な力を兼ね備えた雰囲気を除いて理由がなくても放棄された研究のラインを達成することは難しいようです。これは、宗教的な熱意とドイツのナチス、ロシアのスターリン主義者と中国の「文化革命」の条件のもとで起こったことです。ほとんどの場合、アメリカでは起こりません。

 

“Those who know who and what they are do not need to ask what they should do.” - page 273. Let me assure the reader that there is nothing in the book that offers any way to interpret this pomposity. I take it as another plea to be free, of the bondage of having to give reasons for his denunciations.

「誰が誰であるかを知っている人は、何をすべきか尋ねる必要はありません」 - 273ページ。私はこの本を解釈する方法を提供する本は何もないということを読者に保証してもらいたい。私は彼の宣告の理由を述べなければならないという束縛の、自由であるという別の嘆願としてそれを取る。

 

The menace of such grandiloquent precepts is that they require a priesthood to apply them to particular cases, and would—be priests quickly crystallize around any potential center of power. A corollary of this is that people can be attacked for what they are rather than for anything specific they have done. The April 1976 issue of Ms. has a poignant illustration of this in an article about “trashing”.

そのような大胆な戒律の脅威は、特定の場合にそれらを適用するために神権が必要であり、司祭が潜在的な権力中心を素早く結成することである。これの結論は、人々は彼らがした特定のものではなく、彼らが何であるかを攻撃することができるということです。 1976年4月号のMs.は、「ゴミ箱」に関する記事でこれを鋭意に描いています。

 

“An individual is dehumanized whenever he is treated as less than a whole person”. — page 266. This is also subject to priestly interpretation as in the encounter group movement.

「個人は、全体よりも少なく扱われたときはいつも、非人間化されている」 - 266ページ。これは、エンカウンターグループ(集団心理療法)運動のような聖職者の解釈の対象となります。

 

“The first kind [of computer application] I would call simply obscene. These are ones whose very contemplation ought to give rise to feelings of disgust in every civilized person. The proposal I have mentioned, that an animal’s visual system and brain be coup led to computers, is an example. It represents an attack on life itself. One must wonder what must have happened to the proposers’ perception of life, hence to their perceptions of themselves as part of the continuum of life, that they can even think of such a thing, let alone advocated it”. No argument is offered that might be answered, and no attempt is made to define criteria of acceptability. I think Weizeribaum and the scientists who have praised the book may be surprised at some of the repressive uses to which the book will be put. However, they will be able to point to passages in the book with quite contrary sentiments, so the repression won’t be their fault.

「最初の種類のコンピュータアプリケーションの場合、私は単に品格がないと呼ぶだろう。これらは、非常に熟考しているすべての文明人の嫌悪感を引き起こすべきものです。私が言及した提案は、動物の視覚システムと脳がコンピュータにつながるクーデターであることが一例です。それは人生そのものへの攻撃を表しています。提案者の人生の認識に何が起こったのだろうか、ひいては人生の連続の一部としての彼ら自身の認識に疑問を投げかけなければならない」答えることのできる議論は提供されておらず、受容性の基準を定義しようとする試みはなされていません。私はWeizeribaumとその本を賞賛している科学者が、本が置かれる抑圧的な用途のいくつかに驚くかもしれないと思います。しかし、彼らはかなり反対の感情で本の文章を指すことができるので、抑圧は彼らのせいではありません。

 

2. BUT HERE’S A TRY AT SUMMARIZING

2. でも、ここで要約してみましょう

 

As these inconsistent passages show, it isn’t easy to determine Weizenbaum’s position, but the following seem to be the book’s main points:

これらの矛盾した箇所が示すように、Weizenbaumの立場を判断することは容易ではありませんが、以下の点が本の主な点です。

 

1. Computers cannot be made to reason usefully about human affairs,

1. コンピュータは、人間の行いについて有益に理由を付けることはできない。


This is supported by quoting overoptimistic prediction s by computer Scientists and giving examples non—verbal human communication. However, Weizenbaum doesn’t name any specific task that computers cannot carry out, because he wishes “to avoid the unnecessary, interminable, and ultimately sterile exercise of making a catalogue of what computers will and will not be able to do, either here and now or ever”. It is also stated that human and machine reasoning are incomparable and that the sensory experience of a human is essential for human reasoning.

これは、コンピュータ科学者による過度の予測を引用し、非言語的な人間のコミュニケーションの例を挙げることによって支持されている。しかし、Weizenbaumは、コンピュータが実行することができない具体的な任務については何も言及していません。なぜなら、彼は、不要な、間に合わない、そして最終的には無駄なコンピュータのカタログを作成することを避けることを望んでいます。また、人間と機械の推論は比類のないものであり、人間の感覚的な経験は人間の理性にとって不可欠であると述べられています。

 

2. There are tasks that computers should not be programmed to do.

2. コンピュータにプログラムするべきではないタスクがある。


Some are tasks Weizenbaum thinks shouldn’t be done at all - mostly for new left reasons. One may quarrel with his politics, and I do, but obviously computers shouldn’t do what shouldn’t be done. However, Weizenbaum also objects to computer hookups to animal brains and computer conducted psychiatric interviews. As to the former, I couldn’t tell whether he is an antivivisectionist, but he seems to have additional reasons for calling them “obscene”. The objection to computers doing psychiatric interviews also has a component beyond the conviction that they would necessarily do it badly. Thus he says, “What can the psychiatrist’s image of his patient be when he sees himself, as a therapist, not as an engaged human being acting as a healer, but as an information processor following rules, etc.?” This seems like the renaissance era religious objections to dissecting the human body that came up when science revived. Even the Popes eventually convinced themselves that regarding the body as a machine for scientific or medical purposes was quite compatible with regarding it as the temple of the soul. Recently they have taken the same view of studying mental mechanisms for scientific or psychiatric purposes.

(ほとんど新左翼的な理由から)Weizenbaumが何もしてはいけないと考える仕事があります。彼の闘争と争うかもしれませんし、私はそうしますが、明らかにコンピューターはやらなければならないことをすべきではないようです。Weizenbaumはまた、動物の脳へのコンピュータ接続やコンピュータによる精神医学的インタビューに反対しています。前者については、彼が抗議集団であるかどうかは分からなかったのですが、彼はそれを「品格がない」と呼ぶ理由があるようです。精神医学的インタビューを行っているコンピュータへの異議も、必然的に悪いことになるという確信を超える要素を含んでいます。それ故、彼は「セラピストとして自分自身を見ているときに、精神科医の患者のイメージは、治療者として従事する人間としてではなく、ルールなどの情報プロセッサとして何を見ることができますか?」と言います。これは、科学が復活したときに現れたルネサンス時代の人体解剖に対する宗教的な反対のようです。教皇たちでさえ、最終的には、身体を科学的または医学的目的の機械とみなすことは、それを魂の寺院とみなすことと非常に相容性であると確信しました。最近、彼らは科学的または精神医学的目的のための精神的メカニズムを研究するという同じ見解をとっています。

 

3. Science has led people to a wrong view of the world and of life.

3. 科学は人々に世界と人生の間違った見方を導いてきた。


The view is characterized as mechanistic, and the example of clockwork is given. (It seems strange for a computer scientist to give this example, because the advance of the computer model over older mechanistic models is that computers can and clockwork can’t make decisions.) Apparently analysis of a living system as composed of interacting parts rather than treating it as an unanalyzed whole is bad.

この見解は機械論的なものであり、時計の例が挙げられています。(コンピュータモデルが古くからの機械論的モデルよりも進歩したことにより、コンピュータができる意思決定が時計仕掛けにはできないということから、この例を与えることはコンピュータ科学者にとっては奇妙なことです)分析されていない全体を扱うのではなく、相互作用する部分だけで構成される生命体の分析が間違っているのは明らかです。

 

 

4. Science is not the sole or even main source of reliable general knowledge.

4. 科学は信頼できる唯一あるいは主要な一般知識の源ではない。


However, he doesn't propose any other sources of knowledge or say what the limits of scientific knowledge is except to characterize certain thoughts as “obscene”.

しかし、他の知識源を提案したり、科学的知識の限界が「節度を欠いた」特定の考えを特徴付けること以外は何も言いません。

 

 

5. Certain people and institutions are attacked .

5. 特定の人々や組織が攻撃されている。


These include the Department of “Defense” (sic), Psychology Today, the New York Times Data Bank , compulsive computer programmers, Kenneth Colby, Marvin Minsky, Roger Schank, Allen Newell, Herbert Simon, J.W. Forrester, Edward Fredkin, B.F. Skinner, Warren McCulloch(until he was old), Laplace and Leibniz.

これには国防総省、Psychology Today、ニューヨークタイムズ・データバンク、強迫的なコンピュータープログラマー、Kenneth Colby、Marvin Minsky、Roger Schank、Allen Newell、Herbert Simon、J.W. Forrester、Edward Fredkin、B.F. Skinner、Warren McCulloch、ラプラスライプニッツが含まれます。

 

 

6. Certain political and social views are taken for granted.

6. 特定の政治的・社会的見解が当然とらえられている。


The view that U.S. policy in Vietnam was “murderous” is used to support an attack on “logicality” (as opposed to “rationality”) and the view of science as a “slow acting poison”. The phrase “It may be that the people’s cultivated and finally addictive hunger for private automobiles..." (p.30) makes psychological, sociological, political, and technological presumptions all in one phrase. Similarly, “Men could instead choose to have truly safe automobiles, decent television, decent housing for everyone, or comfortable, safe, and widely distributed mass transportation.” presumes wide agreement about what these things are, what is technologically feasible, what the effects of changed policies would be, and what activities aimed at changing people’s taste are permissible for governments.

ベトナムにおける米国の政策が「殺人的」であるという見方は、(「合理性」とは対照的に)「論理性」と「遅い作用の毒」としての科学観に対する攻撃を支援するために使用されています。「人々の洗練された、最終的には習慣性のある飢えが私的な自動車のためにあるかもしれない...」(p.30)という言葉は、心理的社会学的、政治的、技術的な前提を一言にまとめています。同様に、「人間は本当に安全な自動車、まともなテレビ、誰にとってもまともな住宅、広く快適で安全かつ広く普及している大衆交通機関を持つことを選ぶことができます」と述べています。政策が成立し、人々の嗜好を変えることを目的とした活動は政府にとって許容されるものです。

 


3. THE ELIZA EXAMPLE

3. ELIZA の事例

 

Perhaps the most interesting part of the book is the account of his own program ELIZA that parodies Rogerian non-directive psychotherapy and his anecdotal account of how some people ascribe intelligence and personality to it. In my opinion, it is quite natural for people who don’t understand the notion of algorithm to imagine that a computer computes analogously to the way a human reasons. This leads to the idea that accurate computation entails correct reasoning and even to the idea that computer malfunctions are analogous to human neuroses and psychoses. Actually, programming a computer to draw interesting conclusions from premises is very difficult and only limited success has been attained. However, the effect of these natural misconceptions shouldn't be exaggerated; people readily understand the truth when it is explained, especially when it applies to a matter that concerns them. In particular, when an executive excuses a mistake by saying that he placed excessive faith in a computer, a certain skepticism is called for.

おそらく、本書の最も興味深い部分は、ロジェリアの非指向性精神療法を模倣する彼自身のプログラムELIZAの記述と、ある人々が知性と性格をそれに帰する方法に関する彼の逸話的な説明でしょう。私の意見では、アルゴリズムという概念を理解していない人にとっては、コンピュータが人間的なやり方に似ていると想像するのは当然です。これは、正確な計算が正しい推論を必要とし、コンピュータの誤動作が人間の神経症や精神病に類似しているという考えに至るという考えにつながります。実際に、前提から興味深い結論を引き出すためにコンピュータをプログラミングすることは非常に困難であり、限られた成功しか達成されていません。しかし、これらの自然な誤解の影響は誇張されるべきではありません。人々はそれが説明された際、特にそれが関係する事柄に当てはまるときには真実を容易に理解します。特に、経営幹部がコンピュータに過度の信用を置いたと言って間違いを犯すと、ある種の懐疑心が叫ばれます。

 

Colby’s (1973) study is interesting in this connection, but the interpretation below is mine. Colby had psychiatrists interview patients over a teletype line and also had them interview his PARRY program that simulates a paranoid. Other psychiatrists were asked to decide from the transcripts whether the interview was with a man or with a program, and they did no better than chance. However, since PARRY is incapable of the simplest causal reasoning, if you ask, “How do you know the people following you are Mafia” and get a reply that they look like Italians, this must be a man not PARRY. Curiously, it is easier to imitate (well enough to fool a psychiatrist) the emotional side of a man than his intellectual side. Probably the subjects expected the machine to have more logical ability, and this expectation contributed to their mistakes. Alas, random selection from the directory of the Association for Computing Machinery did no better.

コルビー(1973)の研究はこの点で興味深いですが、以下の解釈は私のものです。コルビーは精神科医にテレタイプラインで患者を面接させ、また、彼らにはパラノイドをシミュレートする彼のPARRYプログラムにインタビューしました。他の精神科医には、インタビューが人間かプログラムかにかかわらず、記録から決定するよう求められ、彼らはチャンスよりもうまくいきませんでした。しかし、PARRYはもっとも簡単な因果関係ができないので「あなたの次の人々がマフィアであることをどのように知っていますか」と尋ねれば、彼らはイタリア人のように見えるという返答が返ってきます。奇妙なことに、知的側面よりも人間の感情面を模倣することは(精神科医をだますには十分)簡単です。おそらく被験者は機械がより論理的な能力を持つことを期待していたでしょう。そして、この期待は彼らの間違いに寄与しました。悲しいかな、ACMディレクトリからの無作為な選択は良くありませんでした。

 

It seems to me that ELIZA and PARRY show only that people , including psychiatrists, often have to draw conclusions on slight evidence, and are therefore easily fooled. If I am right, two sentences of instruction would allow them to do better.

ELIZAとPARRYは、精神科医を含む人々はしばしばわずかな証拠で結論を出さなければならず、したがって容易にばかげていることを示しているようです。私が正しいとすれば、2つの手順となる文章でより良くなります。

 

In his 1966 paper on ELIZA (cited as 1965), Weizenbaum writes,

1966年のELIZA(1965年引用)の論文で、Weizenbaumは次のように書いています。

 

“One goal for an augmented ELIZA program is thus a system which already has access to a store of information about some aspect of the real world and which, by means of conversational interaction with people, can reveal both what it knows, i.e. behave as an information retrieval system, and where its knowledge ends and needs to be augmented. Hopefully the augmentation of its knowledge will also be a direct consequence of its conversational experience. It is precisely the prospect that such a program will converse with many people and learn something from each of them which leads to the hope that it will prove an interesting and even useful conversational partner.” Too bad he didn’t successfully pursue this goal; no-one else has. I think success would have required a better understanding of formalization than is exhibited in the book.

「ELIZAプログラムの拡張の1つの目標は、現実の世界のいくつかの側面についての情報の記憶に既にアクセスし、人々との対話的相互作用によって、それが知っていることを両者が明らかにすることができるシステム、すなわち、情報検索システムとして動作し、その知識がなければ、拡張される必要がある場所です。うまくいけば知識の拡大は、会話経験の直接的な結果にもなります。そのようなプログラムが多くの人々と会話し、それぞれから何かを学ぶことは、興味深く、役に立つ会話のパートナーでもあるという希望につながるのは確かな見通しです。」他には誰もいなかったのに、あまりにも彼はこの目標を首尾良く追い求めていなかった。成功はこの本に展示されているよりも、公式化のより良い理解を必要としていたであろうと私は思います。

 

 

 

4. WHAT DOES HE SAY ABOUT COMPUTERS?

4. 彼はコンピュータについて何を知っているのだろうか?

 

While Weizenbaum ’s main conclusions concern science in general and are moralistic in character , some of his remarks about computer science and A l are worthy of comment.

Weizenbaumの主な結論は一般的に科学に関わるものであり、道徳主義的であるが、コンピュータサイエンスとA lに関する彼の発言の一部はコメントする価値があります。

 

1. He concludes that since a computer cannot have the experience of a man, it cannot understand a man. There are three points to be made in reply. First , humans share each other’s experiences and those of machines or animals only to a limited extent. In particular, men and women have different experiences. Nevertheless, it is common in literature for a good writer to show greater understanding of the experience of the opposite sex than a poorer writer of that sex. Second, the notion of experience is poorly understood; if we understood it better, we could reason about whether a machine could have a simulated or vicarious experience normally confined to humans. Third, what we mean by understanding is poorly understood, so we don’t yet know how to define whether a machine understands something or not.

1. 彼は、コンピュータは人間の経験を持つことができないので、人間を理解することはできないと結論づけています。回答には3つのポイントがあります。第一に、人間はお互いの経験を共有しますが、機械や動物の経験を限られた範囲でしか共有しません。特に、男性と女性は異なる経験をしています。それにもかかわらず、良い作家が貧しい作家よりも異性の経験をより深く理解することは、文学ではよくあることです。第二に、経験の概念はあまり理解されていません。私たちがそれをよりよく理解すれば、通常は人間に限定されたシミュレートされた、あるいは代理的な経験をマシンが持つことができるかどうかを判断することができます。第三に、理解を意味するものはあまり理解されていないので、マシンが何かを理解するかどうかを定義する方法はまだ分かりません。

 

2. Like his predecessor critics of artificial intelligence, Taube, Dreyfus and Lighthill, Weizenbaum is impatient, implying that if the problem hasn’t been solved in twenty years, is time to give up. Genetics took about a century to go from Mendel to the genetic code for proteins, and still has a long way to go before we will fully understand the genetics and evolution of intelligence and behavior. Artificial intelligence may be just as difficult. My current answer to the question of when machines will reach human—level intelligence is that a precise calculation shows that we are between 1.7 and 3.1 Einsteins and .3 Manhattan Projects away from the goal. However, the current research is producing the information on which the Einstein will base himself and is producing useful capabilities all the time.

2. Taube、Dreyfus、Lighthillといった彼以前の人工知能の評論家のように、Weizenbaum は性急で、この問題が20年後に解決されなければ、あきらめてしまうことを仄めかしてしています。遺伝学はメンデルからタンパク質の遺伝暗号にいたるまでに一世紀もかかりましたが、知性と行動の遺伝学と進化を完全に理解するまでにはまだ長い道のりがあります。人工知能はそれほど難しいかもしれません。マシンが人間のレベルの知性に到達するときの質問に対する私の現在の答えは、正確な計算によれば、1.7~3.1 アインシュタインとマンハッタンプロジェクトの 0.3 くらい私たちは目標から離れていることがわかります。しかし、現在の研究は、アインシュタイン自身の基盤となる情報を生み出しており、常に有用な能力を生み出しています。

 

3. The book confuses computer simulation of a phenomenon with its formalization in logic. A simulation is only one kind of formalization and not often the most useful — even to a computer. In the first place, logical and mathematical formalizations can use partial information about a system insufficient for a simulation. Thus the law of conservation of energy tells us much about possible energy conversion systems before we define even one of them. Even when a simulation program is available, other formalizations are necessary even to make good use of the simulation. This review isn’t the place for a full explanation of the relations between these concepts.

3. この本は論理の形式化と現象のコンピュータ・シミュレーションを混同しています。シミュレーションは、一種の形式化であり、コンピュータにとってさえも、最も有用とは限りません。まず、論理および数式の形式化では、シミュレーションを行うには不十分なシステムに関する部分的な情報を使用できます。したがって、エネルギーの保存の法則は、可能性のあるエネルギー変換システムについて、そのうちの1つでも定義する前に、私たちに多くのことを教えてくれます。シミュレーションプログラムが利用可能であっても、シミュレーションをうまく利用するためには他の形式化が必要です。このレビューは、これらの概念間の関係の完全な説明のための場所ではありません。

 

Like Punch’s famous curate’s egg, the book is good in parts. Thus it raises the following interesting issues:

パンチの有名なキュレーターの卵のように、この本は部分的に優れています。したがって、次の興味深い問題が発生します。

 

1. What would it mean for a computer to hope or be desperate for love?

1. コンピュータが求愛する、あるいは愛を諦めるということは、どういう意味ですか?

Answers to these questions depend on being able to formalize (not simulate) the phenomena in question. My guess is that adding a notion of hope to an axiomatization of belief and wanting might not be difficult. The study of propositional attitudes in philosophical logic points in that direction.

これらの質問への答えは、問題の現象を正式化できる(シミュレートしない)ことに依存します。私の推測は、信念と欲望の公理化に希望の概念を加えることは難しくないかもしれないということです。哲学的論理における命題的な考え方の研究はその方向を目指しています。

 

2. Do differences in experience make human and machine intelligence necessarily so different that it is meaningless to ask whether a machine can be more intelligent than a machine?

2. 経験の違いによって、人間と機械のインテリジェンスが必然的に大きく異なるため、マシンよりもインテリジェントなマシンがあるかどうかを尋ねる意味がありませんか?

 

My opinion is that comparison will turn out to be meaningful. After all, most people have not doubt that humans are more intelligent than turkeys. Weizenbaum’s examples of the dependence of human intelligence on sensory abilities seem even refutable, because we recognize no fundamental difference in humanness in people who are severely handicapped sensorily, e.g. the deaf, dumb and blind or paraplegics.

私の意見は、比較が有意義であることが判明するということです。結局のところ、ほとんどの人は、人間が七面鳥よりも知的であることを疑うことはありません。 Weizenbaumの知覚能力への人間の知性の依存の例は、たとえ感受性に重度の障害を持つ人々(例えば、聴覚障害者、愚痴、盲人または対麻痺患者)の人間性に根本的な違いがないことを認識しているので、改訂することさえ可能であるようです。 

 

5. IN DEFENSE OF THE UNJUSTLY ATTACKED ・ SOME OF WHOM ARE INNOCENT

5. 国防総省の不当な攻撃とそれを頼りにしている誰か

 

Here are defenses of Weizeribaum’s targets. They are not guaranteed to entirely suit the defendees.

ここはWeizeribaumの攻撃目標の防衛です。彼らは非防衛者を完全に適合することを保証していません。

 

Weizenbaum’s conjecture that the Defense Department supports speech recognition research in order to be able to snoop on telephone conversations is biased, baseless, false, and seems motivated by political malice. The committee of scientists that proposed the project advanced quite different considerations, and the high officials who made the final decisions are not ogres. Anyway their other responsibilities leave them no time for complicated and devious considerations. I put this one first, because I think the failure of many scientists to defend the Defense Department against attacks they know are unjustified, is unjust in itself, and furthermore has harmed the country.
国防総省が電話会話を盗聴できるように音声認識研究を支援しているとのWeizenbaum憶測は、偏見があり、根拠がなく、誤っており、政治的な悪意を持っているようです。このプロジェクトを提案した科学者委員会は全く異なる検討を行いましたし、最終決定を下した高官は人喰い鬼ではありません。とにかく、彼らのその他の責任を抱えていることから、彼らに複雑で邪悪な考慮のための時間はありません。これを最初に述べますが、多くの科学者が、彼らが知っている攻撃に対して国防総省を守ることが正当化されていないので、それ自体が不公平であり、さらには国を傷つけてしまいました。

 

Weizenbaum doubts that computer speech recognition will have cost -- effective applications beyond snoop ing on phone conversations. He also says, “There is no question in my mind that there is no pressing human problem that will be more easily solved because such machines exist”. I worry more about whether the programs can be made to work before the sponsor loses patience. Once they work, costs will come down. Winograd pointed out to me that many possible household applications of computers may not be feasible without some computer speech recognition. One needs to think both about how to solve recognized problems and about opportunities to put new technological possibilities to good use. The telephone was not invented by a committee considering already identified problems of communication.

Weizenbaumはコンピュータの音声認識が電話会話を詮索する以上の費用対効果の高いアプリケーションを持つことを疑っています。彼はまた「そのようなマシンが存在するため、より簡単に解決される、人類の緊急の問題ではないということは私の心の中に疑問がありません」と述べています。私はスポンサーが忍耐を失う前にプログラムを作れるかどうかについてもっと心配しています。一度でも作業すればコストが下がります。Winogradは、多くのコンピューターに可能な家庭用アプリケーションは、コンピューターの音声認識なしでは実現できない可能性があることを私に指摘しました。認識された問題を解決する方法と、新しい技術的可能性を有効に活用する機会について考える必要があります。電話はすでに確認されたコミュニケーションの問題を考慮して委員会によって発明された訳ではありません。

 

Referring to Psychology Today as a cafeteria simply excites the snobbery of those who would like to consider their psychological knowledge to be above the popular level. So far as I know, professional and academic psychologists welcome the opportunity offered by Psychology Today to explain their ideas to a wide public. They might even buy a cut-down version of Weizenbaum’s book if he asks them nicely. Hmm , they might even buy this review.

カフェテリアとしての Psychology Today を参照するだけで、彼らの心理的な知識が人気のあるレベルを上回っていると思っている人のうなりを興奮させるだけです。私が知る限りでは、プロフェッショナルとアカデミックな心理学者は、Psychology Todayが提供する機会を幅広い人々に説明することを歓迎します。彼らが Weizenbaum の本を上手に尋ねれば、それをカットダウン版として購入するかもしれない。うーん、彼らはこのレビューを買うかもしれない。

 

Weizenbaum has invented a New York Times Data Bank different from the one operated by the New York Times - and possibly better. The real one stores abstracts written by humans and doesn't use the tapes intended for typesetting machines. As a result the user has access only to abstracts and cannot search on features of the stories themselves, i.e. he is at the mercy of what the abstractors thought was important at the time.

WeizenbaumはNew York Timesが運営するものとは異なるNew York Times Data Bankを発明しました -- おそらくそれはより良いでしょう。実際のものは人間によって書かれた抄録を格納しており、組版機械用のテープは使用していません。その結果、ユーザはアブストラクトのみにアクセスでき、ストーリー自体のフィーチャを検索することはできません。すなわち、彼は当時アブストラクトが重要だとだと考える輩の言いなりになっていました。

 

Using computer programs as psychotherapists, as Colby proposed, would be moral if it would cure people. Unfortunately, computer science isn’t up to it, and maybe the psychiatrists aren’t either.

コルビーが提案したように、コンピュータプログラムを心理療法士として使用して人々を治癒させるなら、道徳的なものになるでしょう。残念ながら、コンピュータサイエンスはこれまでのところそうではなく、おそらく精神科医もそうではありません。

 

I agree with Minsky in criticizing the reluctance of art theorists to develop formal theories. George Birkhoff’s formal theory was probably wrong, but he shouldn’t have been criticized for trying. The problem seems very difficult to me, and I have made no significant progress in responding to a challenge from Arthur Koestler to tell how a computer program might make or even recognize jokes. Perhaps some reader of this review might have more success.

ミンスキーが、芸術家が正式な理論を開発することを嫌っていることへの批判に私は同意します。George Birkhoffの公式理論はおそらく間違っていたのですが、彼はそれを試して批判されるべきではありませんでした。この問題は私にとっては非常に難しいようですが、コンピュータプログラムがジョークを作ったり認識したりする方法を教えてくれるArthur Koestlerの挑戦には、大きな進展はありませんでした。おそらく、このレビューの一部の読者はもっと成功するかもしれません。

 

There is a whole chapter attacking “compulsive computer programmers” or “hackers”. This mythical beast lives in the computer laboratory, is an expert on all the ins and outs of the timesharing system, elaborates the time-sharing system with arcane features that he never documents, and is always changing the system before he even fixes the bugs in the previous version. All these vices exist, but I can ’t think of any individual who combines them, and people generally outgrow them. As a laboratory director, I have to protect the interests of people who program only part time against tendencies to over-complicate the facilities. People who spend all their time programming and who exchange information by word of mouth sometimes have to be pressed to make proper writeups. The other side of the issue is that we professors of computer science sometimes lose our ability to write actual computer programs through lack of practice and envy younger people who can spend full time in the laboratory. The phenomenon is well known in other sciences and in other human activities.

"強迫的なコンピュータープログラマー"や "ハッカー"を攻撃する章があります。この神話的なビーストはコンピュータラボに居住し、タイムシェアリング・システムのすべての面倒を見る上では専門家であり、タイムシェアリング・システムの文書化されていない門外漢には理解し難い機能を詳細に述べ、以前のバージョンのバグを修正する前に常にシステムを変更しています。これらの悪条件はすべて存在しますが、私はそれらを組み合わせた個人を考えることはできず、人々は一般にそれを超えて成長します。研究所のディレクターとして、施設を過度に複雑にする傾向に逆らって、パートタイムのみをプログラムする人々の利益を守る必要があります。すべての時間をプログラミングし、口頭で情報を交換する人は、適切な控えを作るために押さなければならないことがあります。問題のもう一つの側面は、コンピュータサイエンスの教授たちが、実践の欠如によって実際のコンピュータプログラムを書く能力を失い、研究室でフルタイムで過ごすことができる若い人たちを羨むことがあるということです。この現象は、他の科学および他の人間の活動においてよく知られています。

 

Weizenbaum attacks the Yale computer linguist, Roger Schank, as follows -- the inner quotes are from Schank: “What is contributed when it is asserted that ‘there exists a conceptual base that is interlingual, onto which linguistic structures in a given language map during the understanding process and out of which such structures are created during generation [of linguistic utterances)’? Nothing at all . For the term ‘conceptual base’ could perfectly well be replaced by the word ‘something’. And who could argue with that so—transformed statement?” Weizenbaum goes on to say that the real scientific problem “remains as untouched as ever”. On the next page he says that unless the “Schank -- like scheme” understood the sentence “Will you come to dinner with me this evening ?” to mean “a shy young man’s desperate longing for love", then the sense in which the system “understands” is “about as weak as the sense in which ELIZA “understood". This good example raises interesting issues and seems to call for some distinctions. Full understanding of the sentence indeed results in knowing about the young man’s desire for love, but it would seem that there is a useful lesser level of understanding in which the machine would know only that he would like her to come to dinner.

Weizenbaumは、イェール大学のコンピュータ言語学者 Roger Schank を次のように攻撃します -- シングルクォートはSchankからの引用です: 「’言語的発話の生成の際にそのような構造が創出された理解過程の間に、与えられた言語の言語構造が写像されている舌の間にある概念的基盤が存在する’と主張されたときに寄与したものは何か?全く何もない。 ’概念ベース’ という言葉は ’何か’ という言葉に完全に置き換えることができる。誰がそんなに変身した声明で議論することができるのだろうか?」Weizenbaumは、現実の科学的問題は「今までと変わらない」と言い続けています。次のページで彼は次のように述べています。『「シャンクさまのスキーム」では、「今晩私と一緒に夕食に来る?」という文は「恥ずかしがり屋の若い男の絶望的な愛への憧憬」を意味しており、システムが「理解する」感覚は ELIZA が「理解した」感覚と同じくらい弱いという意味である。』この良い例は興味深い問題を提起し、いくつかの区別を必要とするようです。文章を完全に理解することは、若者の愛に対する欲求を知ることになりますが、機械が夕食に来てほしいということだけを知っている有用なレベルの理解はないようです。

 

Contrast Weizenbaum’s demanding, more-human-than-thou attitude to Schank and Winograd with his respectful and even obsequious attitude to Chomsky. We have “The linguist’s first task is therefore to write grammars, that is, sets of rules, of particular languages, grammars capable of characterizing all and only the grammatically admissible sentences of those languages, and then to postulate principles from which crucial features of all such grammars can be deduced. That set of principles would then constitute a universal grammar. Chomsky’s hypothesis is, to put it another way, that the rules of such a universal grammar would constitute a kind of projective description of important aspects of the human mind. ”There is nothing here demanding that the universal grammar take into account the young man’s desire for love. As far as I can see, Chomsky is just as much a rationalist as we artificial intelligentsia.

 

Chomsky’s goal of a universal grammar and Schank’s goal of a conceptual base are similar, except that Schank’s ideas are further developed, and the performance of his students’ programs can be compared with reality. I think they will require drastic revision and may not be on the right track at all, but then I am pursuing a rather different line of research concerning how to represent the basic facts that an intelligent being must know about the world. My idea is to start from epistemology rather than from language, regarding their linguistic representation as secondary. This approach has proved difficult, has attracted few practitioners, and has led to few computer programs, but I still think it’s right.

 

Weizenbaum approves of the Chomsky school’s haughty attitude towards Schank, Winograd and other AI based language researchers. On page 184, he states, “many linguists, for example, Noam Chomsky, believe that enough thinking about language remains to be done to occupy them usefully for yet a little while, and that any effort to convert their present theories into computer models would, if attempted by the people best qualified, be a diversion from the main task. And they rightly see no point to spending any of their energies study ing the work of the hackers.”

 

This brings the chapter on “compulsive computer programmers” alias “hackers” into a sharper focus. Chomsky’s latest book Reflections on Language makes no reference to the work of Winograd, Schank, Charniak, Wilks, Bobrow or William Woods to name only a few of those who have developed large computer systems that work with natural language and who write papers on the semantics of natural language. The actual young computer programmers who call themselves hackers and who come closest to meeting Weizenbaum’s description don’t write papers on natural language. So it seems that the hackers whose work need not be studied are Winograd, Schank, et.al. who are professors and senior scientists. The Chomsky school may be embarassed by the fact that it has only recently arrived at the conclusion that the semantics of natural language is more fundamental than its syntax, while AI based researchers have been pursuing this line for fifteen years.

 

The outside observer should be aware that to some extent this is a pillow fight within M.I.T. Chomsky and Halle are not to be dislodged from M.I.T. and neither is Minsky - whose students have pioneered the AI approach to natural language. Schank is quite secure at Yale. Weizenbaum also has tenure. However, some assistant professorships in linguistics may be at stake, especially at M.I.T.

 

Allen Newell and Herbert Simon are criticized for being overoptimistic and are considered morally defective for attempting to describe humans as difference-reducing machines. Simon’s view that the human is a simple system in a complex environment is singled out for attack. In my opinion, they were overoptimistic, because their GPS model on which they put their bets wasn’t good enough. Maybe Newell’s current production system models will work out better. As to whether human mental structure will eventually turn out to be simple, I vacillate but incline to the view that it will turn out to be one of the most complex biological phenomena.

 

I regard Forrester’s models as incapable of taking into account qualitative changes, and the world models they have built as defective even in their own terms, because they leave out saturation—of—demand effects that cannot be discovered by curve-fitting as long as a system is rate—of—expansion limited. Moreover, I don’t accept his claim that his models are better suited than the unaided mind in “interpreting how social systems behave”, but Weizenbaum’s sarcasm on page 246 is unconvincing. He quotes Forrester, “[desirable modes of behavior of the social system] seem to be possible only if we have a good understanding of the system dynamics and are willing to endure the self—discipline and pressures that must accompany the desirable mode”. Weizenbaum comments, “There is undoubtedly some interpretation of the words ‘system’ and ‘dynamics’ which would lend a benign meaning to this observation”. Sorry, but it looks ok to me provided one is suitably critical of Forrester’s proposed social goals and the possibility of making the necessary assumptions and putting them into his models.

 

Skinner’s behaviorism that refuses to assign reality to people’s internal state seems wrong to me, but we can’t call him immoral for trying to convince us of what he thinks is true.

 

Weizenbaum quotes Edward Fredkin, former director of Project MAC, and the late Warren McCulloch of M.I.T. without giving their names. pp. 241 and 240. Perhaps he thinks a few puzzles will make the book more interesting, and this is so. Fredkin’s plea for research in automatic programming seems to overestimate the extent to which our society currently relies on computers for decisions. It also overestimates the ability of the faculty of a particular university to control the uses to which technology will be put, and it underestimates the difficulty of making knowledge based systems of practical use. Weizenbaum is correct in pointing out that Fredkin doesn’t mention the existence of genuine conflicts in society, but only the new left sloganeeririg elsewhere in the book gives a hint as to what he thinks they are and how he proposes to resolve them.

 

As for the quotation from (McCulloth 1956), Minsky tells me “this is a brave attempt to find a dignified sense of freedom within the psychological determinism morass”. Probably this can be done better now, but Weizenbaum wrongly implies that McCulloch’s 1956 effort is to his moral discredit.

 

Finally, Weizenbaum attributes to me two statements -- both from oral presentations which I cannot verify. One of them is “The only reason we have not yet succeeded in simulating every aspect of the real world is that we have been lac king a sufficiently powerful logical calculus. I am working on that problem”. This statement doesn’t ex press my present opinion or my opinion in 1973 when I am alleged to have expressed it in a debate, and no—one has been able to find it in the video—tape of the debate.

 

We can’t simulate “every aspect of the real world”, because the initial state information is available, the laws of motion are imperfectly known, and the calculations for a simulation are too extensive. Moreover, simulation wouldn’t necessarily answer our questions. Instead, we must find out how to represent in the memory of a computer the information about the real world that is actually available to a machine or organism with given sensor y capability, and also how to represent a means of drawing those useful conclusions about the effects of courses of action that can be correctly inferred from the attainable information. Having a sufficiently powerful logical calculus is an important part of this problem -- but one of the easier parts.

 

[Note added September 1976 -- This statement has been quoted in a large fraction of the reviews of Weizenbaum’s book (e.g. in Datamation and Nature) as an example of the arrogance of the “artificial intelligentsia”. Weizenbaum firmly insisted that he heard it in the Lighthill debate arid cited his notes as corroboration, but later admitted (in Datamiation) after reviewing the tape that he didn’t, but claimed I must have said it in some other debate. I am confident I didn’t say it, because it contradicts views I have held and repeatedly stated since 1959. My present conjecture is that Weizenbaum heard me say something on the importance of formalization, couldn’t quite remember what, and quoted “what McCarthy must have said” based on his own misunderstanding of the relation between computer modeling and formalization. (His two chapters on computers show no awareness of the difference between declarative and procedural knowledge or of the discussions in the AI literature of their respective roles). Needless to say, the repeated citation by reviewers of a pompous statement that I never made and which is in opposition to the view that I think represents my major contribution to AI is very offensive].

 

The second quotation from me is the rhetorical question, “What do judges know that we cannot tell a computer”. I’ll stand on that if we make it “eventually tell” and especially if we require that it be something that one human can reliably teach another.

 


6. A SUMMARY OF POLEMICAL SINS

6.政治的な兆候の概要

 

The speculative sections of the book contain numerous dubious little theories, such as this one about the dehumanizing effect of of the invention of the clock: “The clock had created literally a new reality; and that is what I meant when I said earlier that the trick man turned that prepared the scene f or the rise of modern science was nothing less than the transformation of nature and of his perception of reality. It is important to realize that this newly created reality was and remains an impoverished version of the older one, for it rests on a rejection of those direct experiences that formed the basis for, and indeed constituted the old reality. The feeling of hunger was rejected as a stimulus for eating; instead one ate when an abstract model had achieved a certain state, i.e. when the hand of a clock pointed to certain marks on the clock’s face (the anthropomorphism here is highly significant too), and similarly for signals for sleep and rising, and so on.”

 

This idealization of primitive life is simply thoughtless. Like modern man, primitive man ate when the food was ready, and primitive man probably had to start preparing it even further in advance. Like modern man, primitive man lived in families whose members are no more likely to become hungry all at once than are the members of a present family.

 

I get the feeling that in toppling this microtheory I am not playing the game; the theory is intended only to provide an atmosphere, and like the reader of a novel, I am supposed to suspend disbelief. But the contention that science has driven us from a psychological Garden of Eden depends heavily on such word pictures.

 

By the way, I recall from my last sabbatical at M.I.T. that the feeling of hunger is more of ten the direct social stimulus for eating for the “hackers” deplored in Chapter 4 than it could have been for primitive man. Often on a crisp New England night, even as the clock strikes three, I hear them call to one another, messages flash on the screens, a flock of hackers magically gathers, and the whole picturesque assembly rushes chattering off to Chinatown.

 

I find the book substandard as a piece of polemical writing in the following respects:

 

1. The author has failed to work out his own positions on the issues he discusses. Making an extreme statement in one place and a contradictory statement in another is rio substitute for trying to take all the factors into account and reach a considered position. Unsuspicious readers can come away with a great variety of views, and the book can be used to support contradictory positions.

 

2. The computer linguists -- Winograd, Schank, et.al. -- are denigrated as hackers and compulsive computer programmers by innuendo.

 

3. One would like to know more precisely what biological and psychological experiments and computer applications he finds acceptable. Reviewers have already drawn a variety of conclusions on this point.

 

4. The terms “authentic”, “obscene”, and “dehumanization" are used as clubs. This is what mathematicians call “proof by intimidation”.

 

5. The book encourages a snobbery that has no need to argue for its point of view but merely utters code words, on hearing which the audience is supposed applaud or hiss as the case may be. The New Scientist reviewer certainly salivates in most of the intended places.

 

6. Finally, when moralizing is both vehement and vague, it invites authoritarian abuse either by existing authority or by new political movements. Imagine, if you can, that this book were the bible of some bureaucracy, e.g. an Office of Technology Assessment, that acquired power over the computing or scientific activities of a university, state, or country. Suppose Weizenbaum’s slogans were combined with the bureaucratic ethic that holds that any problem can be solved by a law forbidding something and a bureaucracy of eager young lawyers to enforce it. Postulate further a vague Humane Research Act and a “public interest” organization with more eager young lawyers suing to get judges to legislate new interpretations of the Act. One can see a laboratory needing more lawyers than scientists and a Humane Research Administrator capable of
forbidding or requiring almost anything.

 

I see no evidence that Weizenbaum forsees his work being used in this way; he doesn’t use the phrase laissez innover which is the would—be science bureaucrat’s analogue of the economist’s laissez faire, and he never uses the indefinite phrase “it should be decided” which is a common expression of the bureaucratic ethic. However, he has certainly given his fellow computer scientists at least some reason to worry about potential tyranny.

 

Let me conclude this section with a quotation from Andrew D. White, the first president of Cornell University, that seems applicable to the present situation - not only in computer science, but also in biology. - “In all modern history, interference with science in the supposed interest of religion, no matter how conscientious such interference may have been, has resulted in the direst evils both to religion and to science, and invariably; and, on the other hand, all untrammelled scientific investigation, no matter how dangerous to religion some of its stages my have seemed for the time to be, has invariably resulted in the highest good both of religion and of science”. Substitute morality for religion and the parallel is clear. Frankly, the feebleness of the reaction to attacks on scientific freedom worries me more than the strength of the attacks.

 


7. WHAT WORRIES ABOUT COMPUTERS ARE WARRANTED?

7.コンピュータについてのどんな懸念があるのか?

 

Grumbling about Weizenbaum’s mistakes and moralizing is not enough. Genuine worries prompted the book, and many people share them. Here are the genuine concerns that I can identify and the opinions of one computer scientist about their resolution: What is the danger that the computer will lead to a false model of man? What is the danger that computers will be misused? Can human— level artificial intelligence be achieved? What, if any, motivational characteristics will it have? Would the achievement of artificial intelligence be good or bad for humanity?

 


1. Does the computer model lead to a false model of man.

1. コンピュータモデルは、人間の誤ったモデルにつながるか?

 

Historically, the mechanistic model of the life and the world followed animistic models in accordance with which, priests and medicine men tried to correct malfunctions of the environment and man by inducing spirits to behave better. Replacing them by mechanistic models replaced shamanism by medicine. Roszak explicitly would like to bring these models back, because he finds them more “human”, but he ignores the sad fact that they don’t work, because the world isn’t constructed that way. The pre-computer mechanistic models of the mind were, in my opinion. unsuccessful, but I think the psychologists pursuing computational models of mental processes may eventually develop a really beneficial psychiatry.

 

Philosophical and moral thinking hasn’t yet found a model of man that relates human beliefs and purposes to the physical world in a plausible way. Some of the unsuccessful attempts have been more mechanistic than others. Both mechanistic and non—mechanistic models have led to great harm when made the basis of political ideology, because they have allowed tortuous reasoning to justify actions that simple human intuition regards as immoral. In my opinion, the relation between beliefs, purposes and wants to the physical world is a complicated but ultimately solvable problem. Computer models can help solve it, and can provide criteria that will enable us to reject false solutions. The latter is more important for now, and computer models are already hastening the decay of dialectical materialism in the Soviet Union.

 


2. What is the danger that computers will be misused?

2.コンピュータが悪用される危険性とは何か?

 

Up to now, computers have been just another labor-saving technology. I don’t agree with Weizenbaum’s acceptance of the claim that our society would have been inundated by paper work without computers. Without computers, people would work a little harder and get a little less for their work. However, when home terminals become available, social changes of the magnitude of those produced by the telephone and automobile will occur. I have discussed them elsewhere, and I think they will be good - as were the changes produced by the automobile and the telephone. Tyranny comes from control of the police coup led with a tyrannical ideology; data banks will be a minor convenience. No dictatorship yet has been overthrown for lack of a data bank.

 

One’s estimate of whether technology will work out well in the future is correlated with one’s view of how it worked out in the past. I think it has worked out well e.g. cars were not a mistake and am optimistic about the future. I feel that much current ideology is a combination of older anti—scientific and anti—technological views with new developments in the political technology of instigating and manipulating fears and guilt feelings.

 


3. What motivations will artificial intelligence have?

3.人工知能にはどんな動機があるか?

 

It will have what motivations we choose to give it. Those who finally create it should start by motivating it only to answer questions and should have the sense to ask for full pictures of the consequences of alternate actions rather than simply how to achieve a fixed goal, ignoring possible side—effects. Giving it human motivational structure with its shifting goals sensitive to physical state would require a deliberate effort beyond that required to make it behave intelligently.

 


4. Will artificial intelligence be good or bad?

4.人工知能は良いのだろうか?悪いのだろうか?

 

Here we are talking about machines with the same range of intellectual abilities as are posessed by humans. However, the science fiction vision of robots with almost precisely the ability of a human is quite unlikely, because the next generation of computers or even hooking computers together would produce an intelligence that might be qualitatively like that of a human, but thousands of times faster. What would it be like to be able to put a hundred years thought into every decision? I think it is impossible to say whether qualitatively better answers would be obtained ; we will have to try it and see.

 

The achievement of above—human—level artificial intelligence will open to humanity an incredible variety of options. We cannot now fully envisage what these options will be, but it seems apparent that one of the first uses of high—level artificial intelligence will be to determine the consequences of alternate policies governing its use. I think the most likely variant is that man will use artificial intelligence to transform himself, but once its properties and the
conequences of its use are known, we may decide not to use it. Science would then be a sport like mountain climbing; the point would be to discover the facts about the world using some stylized limited means. I wouldn’t like that, but once man is confronted by the actuality of full AI. they may find our opinion as relevant to them as we would find the opinion of Pithecanthropus about whether subsequent evolution took the right course.

 

 

5. What shouldn’t computers be programmed to do.

5.コンピュータをプログラムするべきではないものとは何か。

 

Obviously one shouldn’t program computers to do things that shouldn’t be done. Moreover, we shouldn’t use programs to mislead ourselves or other people. Apart from that, I find none of Weizenbaum’s examples convincing. However, I doubt the advisability of making robots with human-like motivational and emotional structures that might have rights and duties independently of humans. Moreover, I think it might be dangerous to make a machine that evolved intelligence by responding to a program of rewards and punishments unless its trainers understand the intellectual and motivational structure being evolved.

 

All these questions merit and have received more extensive discussion, but I think the only rational policy now is to expect the people confronted by the problem to understand their best interests better than we now can. Even if full Al were to arrive next year, this would be right. Correct decisions will require an intense effort that cannot be mobilized to consider an eventuality that is still remote. Imagine asking the presidential candidates to debate on TV what each of them would do aboux each of the forms that full AI might take.

 


References:

McCulloch, W.S.(1956)
Toward some circuitry of ethical robots or an observational science of the genesis of social evaluation in the mind-like behavior of artifacts.
Acta Biotheoretica, XI, parts 3/4, 147—156

 

This review is filed as WEIZEN.REV[PUB,JMC] at SU-AI on the ARPA net.

Any comments sent to JMC@ SU-AI will be stored in the directory PUB,JMC also known as McCarthy’s Electric Magazine.
The comment files will be designated WEIZEN.1, WEIZEN.2, etc.

--

John Mccarthy
Artificial Intelligence Laboratory
Stanford, California 94305
September 16, 1976

---------+---------+---------+---------+---------+---------+---------+---------+

 

僕のホラは、次の3月18日にリアルになるか?

Will my big talk be real next March 18 ?


2022/12/25
藤田昭人


5日間連続投稿の最中に kun432 氏に「こっちにも投稿しませんか?」と 誘われて…

qiita.com

実は昨日は一日 Qiita の markdown と格闘してました。 が、やっぱりエディタは慣れてないとねぇ…
どうやら Advent Calendar の執筆は 外部のブログでも良いようなので、 結局、慣れてる「はてなブログ」 で執筆することにしました。

これは「5日間連続投稿」の総集編*1とご理解ください。 Advent Calendar との連携の都合上、 先に公開してないといけないようなので いつもとちょっと勝手が違いますが…


僕の「5日間連続投稿」について

僕は毎年このシーズンになると 京都ノートルダム女子大学の授業「インターネット社会論」の ゲストスピーカーに呼ばれてAIの講義をしてきました。 で、今年の授業に向けて作成したデモプログラムの作成過程を 5つのトピックに分けてブログに書きました。

今、注目のオープンソース音声合成ソフト SHAREVOX の core ライブラリだけを使って、 京都検定 の問題を読み上げる CLI ベースの text-to-speach コマンドを 作成した報告です。

ちゃんと動くところまでは持っていったのですが、 読み上げてくれる「つくよみちゃん」 の声質が気に入らず、 授業での紹介は控えた…という顛末でした。 なので、今のところ未完です😀


SHAREVOX について

SHAREVOX は話題のオープンソース音声合成ソフト VOICEVOX から派生した COEIROINK に続く2番目の fork です。

たぶん、次の YouTube 動画を見てもらうのが一番早そう…*2

www.youtube.com

見た目は macOSWindows で動く ダブルクリック・アプリケーションですが、 中身はウェブ・アプリの構成になっています。

github.com

この構成は派生した COEIROINK と SHAREVOX の2つでも共通で、 僕は SHAREVOX の core を使って読み上げアプリケーションを作りました。

ちなみに…

見た目のポップさとは裏腹に、 VOICEVOXシリーズは 本格的な機械学習の技術を使って 実現されています。

shirowanisan.com

これは COEIROINK の開発者の シロワニさんのブログです。 記事数が少ないので全部目を通すのは 比較的ラクなんですが、 音声合成に関する arXiv の論文 とかを紹介したり… とか機械学習の先端研究の成果を取り入れて かなり高度なことをしていることがわかります*3

前述の、僕が記事にした core ライブラリは、 名工大OpenJTalkONNX runtime による音声合成の複合体です。 GPU を搭載していない僕の旧式の Mac Book でも 実用的なスピードで動くのには驚いてます*4


スマートスピーカーとの関わりは?

しかし kun432 氏は 音声合成ネタオンリーの僕のブログ記事をみて、 何故スマートスピーカーアドベントカレンダーに 誘ってくれたのでしょうかねぇ???

思い当たるのは…

僕を毎年授業に呼んでくれる 吉田智子先生が書いた 12月15日の僕の講義のレポート です。絵が小さいので再掲すると…

次世代AIスピーカー

これは僕が今年の講義で話した 独自研究による「近未来予想」… 平たく言えば僕のホラです😁

ひょっとして、彼は ここまでチェックしてたのかも?

もちろん、これは ただの思いつき…って訳ではなくて、 元祖チャットボットの ELIZE に備わっていた 傾聴対話機能 (厳密には ELIZA が実行するスクリプト DOCTOR の機能) をスマートスピーカーに当てはめた アイデアです*5。第1次AIブームの頃、 チャットボットは「会話を楽しむプログラム」 として(ゲーム的な)人気を博したのですが…

今世紀になったあたりから 「チャットするためのボット」 つまり(自然言語で)何かを命令できるボット との認識が広まった感が僕にはあります。 その延長上の 「音声チャットボット専用デバイス」 としてスマートスピーカーは 位置付けられたのではないでしょうか? でも、ホームユースにおいて 命令したいことってそれほど多くない。 確かに「電気を灯けて」とか 「3分間測って」といったシンプルな命令は 非常に需要は高いと思います。 が、それ以上に高度な命令って なかなか思いつきません。 最近のスマートスピーカーの先細り感の 本質的な原因はこういうところあると 僕は考えています。 やはりチャットボットの原点である 「会話を楽しむデバイス」 に立ち戻った方が良い というのが僕の意見です。

そこには「一人暮らしの高齢者」である 僕の個人的な事情も含まれています。 事実、定年退職を境に誰かと会話する機会が 急激に減りました。そういう生活を半年も 続けていると、なんだか滑舌が悪くなったり、 他の誰かの話し声が聞き取りにくくなったり… もちろん目や声に異常がある訳ではなく、 日常的に声を出して会話する機会が減ると 会話する能力が衰えていくようです。 コロナ禍の影響で同じような体験をした方も いらっしゃるんではないかと思うのですが、 僕のような高齢者の場合は特にこの能力低下が 著しいようです*6

授業では、 このような「人間に寄り添うAI」をメインテーマに、 さらに加齢による記憶力や認知能力の低下を補う 「知的義肢としてのAI」のコンセプトについて 学生諸君に話をしました。


対話してくれるのは誰か?

授業では「次世代AIスピーカー」のコンセプトや 開発目標のみを簡単に説明するに留めましたが…

この場では実現方法に関する これまでの検討について簡単に述べます。

「人間の比較的短い音声メッセージに スピーカーが音声で応答する」 従来のスマートスピーカーとは逆に、 次世代AIスピーカーの場合は 「スピーカーの比較的短い音声メッセージに 人間が音声で応答する」 ので「人間が発話するロングメッセージ」に対応する 音声認識技術に開発の重点を置かなければならないと 考えていたのです。実は夏頃までは…

が、今年の9月に OpenAI *7 が Whisper を公開しました。

openai.com

あくまでも僕個人の見立てなのですが…
ソースコードも公開されている Whisper は音声認識技術の ゲームチェンジャー*8だと僕は考えてまして、 この技術の応用事例の発表は 既に始まってますが、 今後もしばらくは続くだろうと 想像しています*9。やはり、音声認識技術に関しては Whisper の動向を しばらくウォッチしておいた方が 良さげかと考えてます*10

一方、音声合成技術の側、 つまりスピーカー側の発話に関する実装には、 僕が 「対話してくれるのは誰か?」 と呼んでいる問題があると考えてします。 1年ぶりに復活した記事 でも書いたように、僕はほぼ1年前に 「童話の読み聞かせ」 をする音声チャットボットを実装しました。 実装している最中は 「利用者は自分の発言が 正しく伝わっていることに 関心を持つだろう」と、 つまり音声認識に関心が集まるだろうと 考えていたのですが、 完成後に実際に利用した人の感想を聞くと 「iPhoneMacで声が違う」 といった音声合成へ関心を寄せる声が多かった。 僕にとってこれは意外な反応でした。

その後、理由を考えてみたのですが…

人間は聞こえてきた音が言葉のように聞こえると 「それが擬似的であろうが人工的であろうが そこに人格があると仮定し その存在が親和的であるか?敵対的であるか? あるいは信用できるか?否か?を 直感的に判断しようとするのではないか?」 と推測しました。また、この傾向は 高齢者の方が強いとも考えました*11

つまり、デバイスの使用感を支配するのは 音声合成技術ではないかと僕は考えています。

そこで、SHAREVOX core を使った音声合成機能だけの 「次世代AIスピーカー」 のデモシステムを作ることにしました。 その際、よく考えなければならないことが、 既に述べた「対話してくれるのは誰か?」 という問題です。

この問題を考える上でも SHAREVOX (および VOICEVOX から派生したオープンソース) は非常に良い示唆を与えてくれます。 VOICEVOX シリーズの音声合成ソフトウェアはいずれも、 複数のキャラクターをバンドルしています*12。僕は世代的に、 ゲームは全くやらないし、 漫画は読んでもアニメは ほとんど見ない人間なので、 大きく誤解してると思いますが、 VOICEVOX シリーズは ニコニコ動画のコミュニティから 出て来たソフトウェアで、 それ故に複数のキャラクターが バンドルされる事は 極めて自然なことなのだと想像しています。

一方、 数ある音声合成ソフトの中での VOICEVOX シリーズの特徴を考えると、 オープンソースであることと 徹底したキャラクター指向が挙げられるように思います。 特に音声チャットボットを構築する上では、 このキャラクター指向は対話をする人間の 関心と共感を獲得する上で 大きな助けになるのではないか と僕は考えています*13

SHAREVOX では4人6声のキャラクタが標準でバンドルされますが、 僕が特に注目しているのは「つくよみちゃん」です。 というのも、「つくよみちゃん」の声の主である夢前黎さんが 次の「会話テキストデータセット」も作成・配布されているからです。

tyc.rei-yumesaki.net

これは、いわゆる(言語)コーパスでして、 この「会話テキストデータセット」を利用すれば、 単純なルールベースのチャットボットであれば 比較的簡単に構築できそうです。


クリスマスでは終わらない

このように開発者には好条件が揃っているので、 僕は「次世代AIスピーカー」のデモシステムを作ることにしました。

最後にタイトルの「3月18日」について少しだけ…

実は、勧めてくれる方々がいたので、 次のコンテンテストに応募しました。

social-innovation.kyoto.jp

これは事業アイデアのコンテストなので プロトタイプやデモシステムは必須ではありませんし、 コンテスト当時は4分間のプレゼンテーションの時間しかありません。

ですが…

応募した本人でも事業アイデアは夢物語に聞こえそうな内容に思えるので 「何かエビデンスが必要だろうなぁ…」と考えてました。

還暦を迎えて、このところ自分の馬力の衰えを感じることが多かったのですが…

ここへ来て、冒頭の「5日間連続投稿」をなんとかやり切ったので、 久しぶりに3ヶ月一本勝負にチャレンジすることにしました。



若宮正子さんもCMで言ってるじゃないですか…
とにかくバッターボックスに立ってバットを振ってみろって😀

www.youtube.com

以上

*1:NHKの大河ドラマみたいな…

*2:僕は今年の夏、椎間板ヘルニアを発症しまして、 7月、8月、9月の3ヶ月を棒に振りました。

一番、ひどい時は10分間も椅子に座ってられなくて…
寝たきりでスマホを覗くしか やれることがなかったので、 たまたま見つけた動画です。

文字どおり「怪我の功名」ですね😀

*3:たぶん COEIROINK を開発しておられる期間だけ 書いておられたのかな? と想像してます。

*4:ちなみにマスターの VOICEVOX core は今、 Rust 対応を含む全面的な改修を 行なっている最中です。

github.com

Stable なバージョンをお望みの方は、 ひとつ前の 0.13.X か SHAREVOX core を使った方が良さげです。

github.com

*5:ELIZEと傾聴については 大昔にブログに書いたので参考まで…

akito-fujita.hatenablog.com

akito-fujita.hatenablog.com

実は1966年からあるアイデアなのです。

*6:対策はとにかく声を出して会話をすること。 今は毎朝同じ喫茶店に行って、 いつもの店員さんと努力して 世間話をするようにしています。 問題は多少改善したように感じてますが😀

まぁ、街中で暮らしている僕の場合は こういった対策が取れるのですが、 田舎暮らしのうちの両親の場合は 会話の少ない生活を何十年と続けて来たので、 認知症の症状が顕在化しています。

*7:11月に公開された ChatGPT が今話題になっていますよね?

openai.com

*8:純粋に技術的に ゲームチェンジャーであることは もちろんですが、 この技術がオープンソースであることも 音声に関わる既存技術の商業価値に 大きなインパクトを 与えるのではないかと思っています。

*9:例えば、こんなレクチュアなどは 既にたくさん出回っていますね。

gigazine.net

*10:Whisper が公開された今年の9月から半年後、 つまり来年の4月頃までは動向を静観するべき、 と僕自身は考えています。

*11:このように考えると、 過去のうまくいかなかった知見の 辻褄が合うようにも思えるのです

*12:VOICEVOX のキャラクタは以下。

voicevox.hiroshiba.jp

COEIROINK のキャラクタは以下。

coeiroink.com

SHAREVOX のキャラクタは以下。

キャラクター一覧 | SHAREVOX

いずれも音声合成ソフトの開発者ではない方々が 制作したキャラクタですので、 使用条件等には注意が必要なようです。

*13:スマートスピーカーのスキルを書いていた時の 実証実験での僕の数々の苦い経験から言わせてもらうと、 この種のITデバイスに対する 高齢者の心理的ハードルは 皆さんが考えている以上に高いのです。

つくよみちゃん Recitation(未完)

Tsukuyomi-chan Recitation (unfinished)


2022/12/23
藤田昭人


5日間連続投稿の5日目、最終回です。

スマホ全盛で、 帯域を湯水の如く使える今日では 全く需要がないであろう、 CLIベースの音声プログラムの解説記事に お付き合いいただき 大変ありがとうございます。

しかし書き始めたときには全く意識していなかったのですが…

このように「毎日、何か書かなければならない!!」 プレッシャーがかかると、 1980年代のハッキング・レポート風の 記事になっちゃうんですね、 僕は*1。 やっぱりこれが楽しくて プログラムを書いてたんだよなぁ。 すっかり忘れてたけど…

さてさて…

最終日なのでオチをつけなくちゃ‼︎

既に12月に入ってましたが 何とか t2s が動いたので、 当初から考えてた recitation なる プログラムの作成に取りかかりました。 1年ぶりに復活した記事 で口走った 「つくよみちゃん」 に「京都検定」の問題を読み上げてもらう… というヤツです。

でも、これは時間切れで 授業には間にあいませんでした。


京都検定の過去問

ちなみに…

京都検定京都商工会議所が 主催する検定試験ですが

www.kyotokentei.ne.jp

過去問題は試験後に京都新聞に掲載されます。

www.kyoto-np.co.jp

先日実施された第21回の3級の試験問題はこちら

www.kyoto-np.co.jp

1年ぶりに復活した記事 でも語りましたが、 昨年の「童話読み聞かせ」の実習が 学生たちにことの他ウケが良かったので、 「次なるネタ」と僕は密かに考えていたのです*2

僕のような京都在住者にとって、 「京都検定」の問題は 日常生活に密着したトピックが出題されます。 例えば、うちの近所の石薬師御門は、 僕にとって真夏の暑い日の夕暮れに 夕涼みがてらアイスを食べる場所なんですけどね。

それに音声合成のサンプルテキストとしても、 京都特有の(風変わりな読みの)地名や人名が たくさん登場するので、なかなか興味深い*3。なので「つくよみちゃん」に 「京都検定」の問題を読み上げてもらおうと考えてました。


SHAREVOX とCOEIROINK に「京都検定」の問題を読んでもらう

で、講義では VOICEVOX と SHAREVOX、 それから COEIROINK を紹介するつもりだったので、 資料を書く都合から SHAREVOX と COEIROINK に ひとつ前の第20回(令和4年夏)の 第1問の問題文と4択の回答を 読み上げてもらいました。

まずは SHAREVOX から…

次に COEIROINK にも…

いかがでしょうか? Twitter の動画ではわかりにくいかもしれませんが、 生で聞くと COEIROINK の声質のグレードが明らかに上でした。 特に4つの回答例の頭の ア、イ、ウ、エ の発音では SHAREVOX の発声は少し不快な感じがしました。

なるほど 「つくよみちゃん」の声の主である 夢前黎 さんが時折 Twitter で呟いているのは こういうことだったのか…


つくよみちゃん Recitation は…未完

実は、この問題に気がついたのは 授業の前々日ぐらいだったのです。 で、COEIROINKの「つくよみちゃん」ボイスを SHAREVOX に移植する方法でジタバタして半日。 結局、打つ手を思いつかずにタイムアップとなりました。

このジタバタのために大きくタイムロスすることになり、 Recitation のCコードを実装する時間もなくなり、 授業では SHAREVOX と COEIROINK のデモだけにしました。

くそぉ❗️❗️❗️❗️❗️❗️

…ということで、 つくよみちゃん Recitation は今のところ未完です。 問題は声質のグレードの問題だけではなく、 例えば回答例(ア)の「青龍」は「アオリュウ」 って読んじゃうんだよね。 これは SHAREVOX と COEIROINK 共通の問題で、 読みの修正自体は SHAREVOX あるいは COEIROINK でやれば良いのですが、その修正結果を 各々のプロジェクトファイルから 取り出す機能も必要かと…

それに学生諸君に実習してもらうには ウェブアプリ化も必要だし…

まだまだ先は長いなぁ… というのが今の僕の感想です。



でもね…

この作業に没頭していたときの僕は 明らかに35〜6年 若返っていたんだと思います。

そうそう、 僕はこういうことが 楽しいって思えるから プログラマーになったんだよ。 本当に忘れてたけど…

5日間付き合っていただいた 読者の皆さんには 申し訳ないオチですいません。

でも、僕はまだ諦めてませんからね。

それではお約束の…

#つくよみちゃんを利用してフォロワー増やしたい

以上

*1:確か 日本国内ではインターネットが全く普及しておらず、 WWW(World Wide Web)もちろん存在しなかった1986年頃、 それでも電子メールは使えていたし、 今日のSNSとよく似た使用感のある NetNews も存在してました。 そこでは…

ソースコードは全部送ってください。
でもデータ量を抑えるため diff などを活用して。

もちろん説明は必要です。 送った意味がなくなりますから…
でも最小限のコメントやヒントに留めてください。
くれぐれも、くだらないことを書いて データ量を増やさないよう 十分注意してください。

…といった大いに矛盾するチェックが行われていました。

日本国内では JUNET という公衆回線網 (電話線ネットワークですね) による情報インフラが存在したのです。 全く帯域制御のないネットワークですので、 こうやってデータ量を抑制しないと モデムが何時間もピーヒューとなり続けて、 ネットワーク管理者が 「来月の電話代はどれくらい請求されるんだろう?」 と青い顔をしていたのです。30年前ぐらいの話です。

そもそも…

民営化直後のNTTが 「社内の部門に電話代を請求するルールもシステムもない」 を逆手に取って…

NTTの某研究所が日本全国の主要大学に電話をかけまくることでバックボーンを維持する

…という公然の秘密の元に 成り立っていた ゲリラ的アプローチによる 無料ネットワークでしたので、 破綻の兆しは日常のそこらじゅうに 転がっていたのですが…

でも、そんな事情は全く知らない 僕のような鼻垂れ小僧プログラマーは ムキになってレポート風のヨタ話を 毎日投稿していました😀

たぶん当時 「こんな馬鹿げたことは そう長くは続けていけない」 と考えていたのは 村井さんとその周辺だけではないのかな?

*2:もっとも、実際の授業で「京都検定」の話題は出たのですが、 学生諸君の関心は今ひとつという感じでしたが…

*3:先ほどの「いしやくしごもん」を カナ漢字変換すると「石薬師五問」になりませんか?

SHAREVOX core の API を探る(4)jasson

Explore the SHAREVOX core API (4) jasson


2022/12/22
藤田昭人


5日間連続投稿の4日目です。(あと2日)

この記事を今日初めてみた人のために…

この記事は5回シリーズで、 12/15 に京都ノートルダム女子大学で 僕が行った講義のために用意した ちょっとしたツールの作成過程について紹介しています。 なお、毎年僕を講義に呼んでくれる吉田智子先生が 先日の僕が担当した講義の様子をブログ( https://ndsi.kyo2.jp/d2022-12-18.html )で紹介してくれます。ご参考まで…

では、昨日に続き、対話コマンド t2s の話を続けます。


対話形式で喋ってくれるようにはなったのだが…

昨日の記事 でもチラッと触れましたが、 Model ディレクトリを変更して出てきた女性の声は おそらく「小春音アミ」の声なんですよね。

そもそも SHAREVOXの公式リリースには 次の4キャラクター6声が収録されています。

SHAREVOXとキャラクター

たしか「つきよみちゃん」は speaker_id = 4 のはず…

で、 月曜日の記事 に書いたAPI一覧の中から 「登録キャラクター&ボイスの情報を取得できるAPI」 を探したら metas が見つかりました。 でもこれ、戻り値の文字列は JSON なんですよね…


C言語で JSON を扱うには

普通 JSON と言えば 僕も迷わず JavaScript を使うんですが、 今回はC言語縛りなので…

C/C++ 用の JSON ライブラリは多数出回ってますが、 今回は jansson を使うことにしました。

jansson.readthedocs.io

…というのもマニュアルがしっかりしてそうだったから (英語だけど…)。 で、マニュアルを読み始めたのだけど、 jansson の Github Rep をチラ見したらこんなのが見つかった。

github.com

これは jansson のリリースに付属するサンプルなんですが、 対話形式の汎用 JSON パーサーです。 今回は metas の情報一覧を表示するだけなので 「これは丁度いい」 とばかりに、 コードをガシガシ書き換えて実装したのが print_metas.cpp です(後述します)。


収録されているキャラクターを一覧する実装

例によって修正したソースコードは diff の出力を掲載しています。

CMakeLists.txt
$ diff -u CMakeLists.txt.orig CMakeLists.txt
--- CMakeLists.txt.orig 2022-12-22 18:06:36.000000000 +0900
+++ CMakeLists.txt  2022-12-13 10:23:24.000000000 +0900
@@ -13,6 +13,7 @@
 set(OPENAL_DIR "/usr/local/opt/openal-soft")
 message(STATUS "OPENAL_DIR: ${OPENAL_DIR}")

-link_directories("${OPENAL_DIR}/lib")
-add_executable(t2s t2s.cpp play.cpp)
-target_link_libraries(t2s ${CORE_LIB} readline openal)
+include_directories(/usr/local/include)
+link_directories("${OPENAL_DIR}/lib" /usr/local/lib)
+add_executable(t2s t2s.cpp play.cpp print_metas.cpp)
+target_link_libraries(t2s ${CORE_LIB} readline openal jansson)
$ 
t2s.cpp
$ diff -u t2s.cpp.orig t2s.cpp
--- t2s.cpp.orig    2022-12-22 18:06:56.000000000 +0900
+++ t2s.cpp 2022-12-13 14:19:22.000000000 +0900
@@ -1,9 +1,10 @@
 #include <stdio.h>
+#include <ctype.h>
 #include <string.h>
 #include <stdlib.h>

 extern void play(uint8_t *output, int size);
-
+extern void print_table(const char *text);

 #include "../core/src/core.h"

@@ -16,19 +17,17 @@
   if (!initialize(model, false)) {
     printf("coreの初期化に失敗しました\n");
     exit(1);
-  } else {
-    printf("coreの初期化に成功しました\n");
   }

   //printf("metas: %s\n", metas());
-
+  //print_table(load_json(metas()));
+  //print_table(metas());
+
   printf("dic: %s\n", dic);
   result = sharevox_load_openjtalk_dict(dic);
   if (result != SHAREVOX_RESULT_SUCCEED) {
     printf("\n%s\n", sharevox_error_result_to_message(result));
     exit(1);
-  } else {
-    printf("終了\n");
   }
 }

@@ -38,13 +37,13 @@
 {
   SharevoxResultCode result;

-  printf("音声生成中...");
+  //printf("音声生成中...");
   result = sharevox_tts(text, speaker, output_size, output);
   if (result != SHAREVOX_RESULT_SUCCEED) {
      printf("\n%s\n", sharevox_error_result_to_message(result));
      return(-1);
   }
-   printf("終了: %d bytes\n", *output_size);
+   //printf("終了: %d bytes\n", *output_size);
   return(0);
 }

@@ -115,7 +114,7 @@
   return(-1);
 }

-#define    MODEL       "../../model"
+#define    MODEL       "../model"
 #define    OPENJTALK_DIC   "../open_jtalk_dic_utf_8-1.11"
 #define    OUTPUT_WAV_NAME "audio.wav"

@@ -161,17 +160,25 @@
                    &output_binary_size,
                    &output_wav) < 0) exit(1);
       if (output_wav != NULL) play(output_wav, output_binary_size);
-      //printf("# %d bytes\n", output_binary_size);
     } else if (n == 1) {
-      if (strcmp(line, "save") == 0) {
+      if (isnumber(line[0])) {
+        speaker_id = line[0] - '0';
+        printf("speaker id: %lld\n", speaker_id);
+      } else if (strcmp(line, "i") == 0 ||
+                 strcmp(line, "id") == 0) {
+        printf("speaker id: %lld\n", speaker_id);
+      } else if (strcmp(line, "l") == 0 ||
+                 strcmp(line, "list") == 0) {
+        print_table(metas());
+      } else if (strcmp(line, "save") == 0) {
         if (save(OUTPUT_WAV_NAME, output_wav, output_binary_size) < 0) exit(1);
         sharevox_wav_free(output_wav);
          output_wav = NULL;
       } else if (strcmp(line, "show") == 0) {
         if (output_wav != NULL) show(output_wav, output_binary_size);
       } else if (strcmp(line, "p") == 0 ||
-        strcmp(line, "play") == 0) {
-   if (output_wav != NULL) play(output_wav, output_binary_size);
+                 strcmp(line, "play") == 0) {
+        if (output_wav != NULL) play(output_wav, output_binary_size);
       }
     } else {
       printf("[%d] %s\n", n, line);
$ 
play.cpp
$ diff -u play.cpp.orig play.cpp
--- play.cpp.orig   2022-12-22 18:07:17.000000000 +0900
+++ play.cpp    2022-12-11 23:49:05.000000000 +0900
@@ -62,7 +62,7 @@
 {
   wav_header *hp = (wav_header *) output;

-  printf("### play\n");
+  //printf("### play\n");
   //printf("RIFF: 0x%x\n", hp->RIFF);
    if (hp->RIFF != WAVH_RIFF) {
        printf("NOT match riff\n");
@@ -89,8 +89,8 @@
    short wavchannels   = hp->nChannels;
    // nSamplesPerSec(サンプリング周波数)と
    // nAvgBytesPerSec(1秒あたりのバイト数)の違いを説明
-   printf("hp->nSamplesPerSec: %d \n", hp->nSamplesPerSec);
-   printf("hp->nAvgBytesPerSec: %d \n", hp->nAvgBytesPerSec);
+   //printf("hp->nSamplesPerSec: %d \n", hp->nSamplesPerSec);
+   //printf("hp->nAvgBytesPerSec: %d \n", hp->nAvgBytesPerSec);
    int   samplesPerSec = hp->nSamplesPerSec;
   int   byteParSec    = hp->nAvgBytesPerSec;
    //printf("byteParSec: %d \n", byteParSec);
@@ -99,7 +99,7 @@
   short bitsParSample = hp->wBitsPerSample;
    //printf("bitsParSample: %d \n", bitsParSample);

-  printf("ov_datasize: %d\n", hp->ov_datasize);
+  //printf("ov_datasize: %d\n", hp->ov_datasize);
   //printf("ov_data: 0x%x\n", hp->ov_data);
   if (hp->ov_data != WAVH_OV_DATA) {
        printf("NOT match ov data\n");
@@ -111,14 +111,14 @@
   int wavSize         = hp->ov_datasize;
   int wavSamplingrate = samplesPerSec;

-  printf("wavChannels: %d \n", wavChannels);
-   printf("wavBit: %d \n", wavBit);
-   printf("wavSize: %d \n", wavSize);
-   printf("wavSamplingrate: %d \n", wavSamplingrate);
+  //printf("wavChannels: %d \n", wavChannels);
+   //printf("wavBit: %d \n", wavBit);
+   //printf("wavSize: %d \n", wavSize);
+   //printf("wavSamplingrate: %d \n", wavSamplingrate);

   //int time_playback = (float)wavSize / (float)(4*wavSamplingrate);
    int playback_ms = ((float)wavSize / (float)byteParSec) * 1000.0F;
-   printf("playback_ms: %d msec \n", playback_ms);
+   //printf("playback_ms: %d msec \n", playback_ms);
    unsigned char *data = hp->data;

    ALuint source;
$ 

要はデバッグ用のプリントを止めただけです。 あとはキャラクターの一覧表示と選択のために 内部コマンドを追加しました (内部コマンドについては後述)。


こちらが、本稿のホットポイントの print_metas.cpp です。 既に述べたように jansson のリリースに付属する simple_parse.c を 手直しして作成しました。

/*
 * print_metas
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

#include <jansson.h>


json_t *load_json(const char *text) {
    json_t *root;
    json_error_t error;

    root = json_loads(text, 0, &error);

    if (root) {
        return root;
    } else {
        fprintf(stderr, "json error on line %d: %s\n", error.line, error.text);
        return (json_t *)0;
    }
}

void
print_style(json_t *style, const char *primary)
{
  size_t size = json_object_size(style);
  const char *key;
  int id = -1;
  json_t *value;
  char secondary[8192];

  json_object_foreach(style, key, value) {
    if (strcmp(key, "name") == 0) {
      strcpy(secondary, json_string_value(value));
    } else if (strcmp(key, "id") == 0) {
      id = json_integer_value(value);
    }
  }
  if (id > -1) printf("%d: %s  %s\n", id, primary, secondary);
}

void
print_styles(json_t *styles, const char *primary)
{
  if (json_typeof(styles) != JSON_ARRAY) return;
  size_t i;
  size_t size = json_array_size(styles);
  for (i = 0; i < size; i++) {
    json_t *child = json_array_get(styles, i);
    print_style(child, primary);
  }
}

void
print_line(json_t *object)
{
  size_t size = json_object_size(object);
  const char *key;
  json_t *value;
  char primary[8192];
  
  json_object_foreach(object, key, value) {
    if (strcmp(key, "name") == 0) {
      strcpy(primary, json_string_value(value));
    } else if (strcmp(key, "styles") == 0) {
      print_styles(value, primary);
    }
  }
}

void
print_table(const char *text)
{
  size_t i, size;
  json_t *root = load_json(text);
  if (root == NULL) return;
  if (json_typeof(root) != JSON_ARRAY) return;
  size = json_array_size(root);
  for (i = 0; i < size; i++) {
    json_t *child = json_array_get(root, i);
    print_line(child);
  }
}

#if 0
#include <fcntl.h>

#define M1     1048576
#define DEF_PATH    "../sharevox_core-0.1.2/t2s/model/official/metas.json"

int
main()
{
  char buff[M1];

  int fd = open(DEF_PATH, O_RDONLY);
  if (fd < 0) exit(1);
  int n = read(fd, buff, M1);
  if (n < 0) exit(1);

  json_t *root = load_json(buff);
  if (root) {
    //print_json(root);
    print_table(root);
    json_decref(root);
  }

  close(fd);
  exit(0);
}
#endif

ちなみに末尾の '#if 0' の中身は print_metas.cpp を単体で動かすときの main ルーチンです。 SHAREVOX の Model ディレクトリにある metas.json (APIの metas を呼び出した時に 返ってくる JSON 文字列はこのファイルの内容では?) の内容を表示してくれます。


ビルド

昨日までと同様に cmake でビルドします。

$ cd sharevox_core-0.1.2/t2s/
$ rm -rf build
$ mkdir build
$ cd build/
$ cmake ..
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_CXX_FLAGS: -Wno-deprecated-declarations -Wno-writable-strings
-- PARENT: /Users/fujita/xtr/BookBot/BookBot3/06_T2S_JSON
-- TOP_DIR: /Users/fujita/xtr/BookBot/BookBot3/06_T2S_JSON/sharevox_core-0.1.2
-- CORE_LIB: /Users/fujita/xtr/BookBot/BookBot3/06_T2S_JSON/sharevox_core-0.1.2/core/lib/libcore.dylib
-- OPENAL_DIR: /usr/local/opt/openal-soft
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/fujita/xtr/BookBot/BookBot3/06_T2S_JSON/sharevox_core-0.1.2/t2s/build
maverick:build fujita$ cmake --build .
[ 25%] Building CXX object CMakeFiles/t2s.dir/t2s.cpp.o
[ 50%] Building CXX object CMakeFiles/t2s.dir/play.cpp.o
[ 75%] Building CXX object CMakeFiles/t2s.dir/print_metas.cpp.o
[100%] Linking CXX executable t2s
[100%] Built target t2s
$ 


実行

いよいよ完成が近づいたので内部コマンドをちょっと整理しました。

さらに内部コマンドは次のとおりです。

  • 数字1文字:スピーカーIDを設定します。
  • id(i):現在設定されているスピーカーIDを表示します。
  • list(l):現在の model に収録されているキャラクタとスピーカーIDを表示します。
  • save:直前に発話したメッセージを audio.wav に格納します。
  • show:直前に発話したメッセージの WAV ヘッダー情報を表示します。
  • play(p):直前に発話したメッセージを再度発話します。
  • quit、exit(q):t2s を終了します。

まぁ「キャラクタとスピーカーIDの表示」「スピーカーIDの設定」 「発話メッセージ」「終了」ぐらいしか使わないと思いますが…

$ ./t2s
model: ../model
dic: ../open_jtalk_dic_utf_8-1.11
> l
0: 小春音アミ  ノーマル
1: 小春音アミ  喜び
2: 小春音アミ  怒り
3: 小春音アミ  悲しみ
4: つくよみちゃん  ノーマル
5: 白痴ー  ノーマル
6: 開発者  ノーマル
> 4
speaker id: 4
> こんにちは
> つくよみちゃんです
> q
exit
$



ようやく「つくよみちゃん」が喋ってくれました。

#つくよみちゃんを利用してフォロワー増やしたい

でも…

授業ではデモしなかったんです。 いや、できなかったってできなかったって言ったほうが良いかも。

その理由は…明日、説明します。

以上

SHAREVOX core の API を探る(3)OpenAL

Explore the SHAREVOX core API (3) OpenAL


2022/12/21
藤田昭人


昨日の「マクラでモタつくとその日のうちに書き上げるのは難しい」を教訓に…

毎年、僕を講義に呼んでくれる吉田さんが 先日の僕が担当した講義の様子をブログ( https://ndsi.kyo2.jp/d2022-12-18.html )で紹介してくれました。 でも、この「音声チャットボット」について 僕が語り始めるとまたまた収まらなくなるので…

昨日の t2s の続きを進めます。


sharevox_tts が生成するデータ

昨日の記事 でも書きましたが、 せっかく対話インターフェースをつけたのに 読み上げてくれないと興醒めなので、 WAVデータを再生する機能が欲しいところ。

そこで、 まずはWAVデータを生成する sharevox_tts の出力を見てみました。 次のソースコード(抜粋)の箇所です。

  result = sharevox_tts(text.c_str(), speaker_id, &output_binary_size, &output_wav);
  if (result != SHAREVOX_RESULT_SUCCEED) {
    std::cout << sharevox_error_result_to_message(result) << std::endl;
    return 1;
  }

  std::cout << "音声ファイル保存中..." << std::endl;

  std::ofstream wav_file(OUTPUT_WAV_NAME, std::ios::binary);
  wav_file.write(reinterpret_cast<const char*>(output_wav), output_binary_size);
  sharevox_wav_free(output_wav);

コードからもわかるように、 どうやら (ヘッダーを含む) WAVデータが丸々メモリー上に 格納されているようです。 で、音声データを再生する 類似の実装を幾つかチェックしてみたのですが、 データを一旦ファイルに格納し 音声データを再生するコマンド (macOSの場合はafplayとか) を起動する実装が一般的でした。 なんかイマイチなやり方ですねぇ…


WAVファイルの再生方法

そこでオンメモリのWAVデータを (ファイルに格納する事なく) 再生できるオープンソースを 探してみました。 いずれもWAVファイルを再生する ツールだったのですが、 オンメモリ・データの再生に 改造しやすそうな次のサンプルを見つけました。

github.com

このプログラムには元ネタがあるようです*1

WAVファイルのヘッダーの情報などが きっちり定義されていて、 最初の入力ファイルの読み込み部分さえ 外せば上手くいきそう…と思ったのですが、 作業してみたらちょっと上手くないところがありました。 これは後述の「play.cpp」のところで説明します。


OpenAL

上記のサンプルは OpenAL なるライブラリの利用を仮定しています。
例によって、詳細は Wikipedia から…

ja.wikipedia.org

どうやら、ゲームプログラミングでは著名なライブラリのようです。 オリジナルを開発した Loki Software は既に廃業しているようで、今は次の団体が引き継いでるとか…

www.openal.org

でも、オープンソース版は 次のサイトからダウンロードできるようです*2

openal-soft.org

MacBook を使っている僕の場合、 例によってホームブリューで インストールするのが簡単ですね。

formulae.brew.sh


t2s を喋らせる実装

今回は 昨日の記事 に対するアップデートです。

CMakeLists.txt

CMakeLists.txt の修正箇所は次のとおりです。

$ diff -u CMakeLists.txt.orig CMakeLists.txt
--- CMakeLists.txt.orig 2022-12-21 10:42:15.000000000 +0900
+++ CMakeLists.txt  2022-12-10 23:26:14.000000000 +0900
@@ -1,6 +1,8 @@
 cmake_minimum_required(VERSION 3.16)
 project(T2S)
 set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations -Wno-writable-strings")
+message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")

 find_path(PARENT NAMES "sharevox_core-0.1.2" PATHS "../..")
 message(STATUS "PARENT: ${PARENT}")
@@ -8,6 +10,9 @@
 message(STATUS "TOP_DIR: ${TOP_DIR}")
 find_library(CORE_LIB NAMES core PATHS "${TOP_DIR}/core" PATH_SUFFIXES lib)
 message(STATUS "CORE_LIB: ${CORE_LIB}")
+set(OPENAL_DIR "/usr/local/opt/openal-soft")
+message(STATUS "OPENAL_DIR: ${OPENAL_DIR}")

-add_executable(t2s t2s.cpp)
-target_link_libraries(t2s ${CORE_LIB} readline)
+link_directories("${OPENAL_DIR}/lib")
+add_executable(t2s t2s.cpp play.cpp)
+target_link_libraries(t2s ${CORE_LIB} readline openal)
$ 

G++ のコンパイル・オプションを追加し、 OpenAL のライブラリもリンク対象に含めました。

t2s.cpp

t2s.cpp は内部コマンドを幾つか追加しました。

$ diff -u t2s.cpp.orig t2s.cpp
--- t2s.cpp.orig    2022-12-21 10:42:34.000000000 +0900
+++ t2s.cpp 2022-12-11 23:36:11.000000000 +0900
@@ -2,26 +2,28 @@
 #include <string.h>
 #include <stdlib.h>

-#include "../core/src/core.h"
+extern void play(uint8_t *output, int size);

-#define    MODEL       "../../model"
-#define    OPENJTALK_DIC   "../open_jtalk_dic_utf_8-1.11"
-#define    OUTPUT_WAV_NAME "audio.wav"
+
+#include "../core/src/core.h"

 void
-init()
+init(const char *model, const char *dic)
 {
   SharevoxResultCode result;

-  if (!initialize(MODEL, false)) {
+  printf("model: %s\n", model);
+  if (!initialize(model, false)) {
     printf("coreの初期化に失敗しました\n");
     exit(1);
   } else {
     printf("coreの初期化に成功しました\n");
   }

-  printf("openjtalk辞書の読み込み中...");
-  result = sharevox_load_openjtalk_dict(OPENJTALK_DIC);
+  //printf("metas: %s\n", metas());
+
+  printf("dic: %s\n", dic);
+  result = sharevox_load_openjtalk_dict(dic);
   if (result != SHAREVOX_RESULT_SUCCEED) {
     printf("\n%s\n", sharevox_error_result_to_message(result));
     exit(1);
@@ -75,6 +77,27 @@
 }


+// wave format
+
+void
+show(uint8_t *wav, int wsiz)
+{
+  printf("%d bytes\n\n", wsiz);
+  printf("RIFF: %c%c%c%c\n", wav[0], wav[1], wav[2], wav[3]);
+  printf("size: %d\n",            *((int32_t *) &wav[4]));
+  printf("WAVE: %c%c%c%c\n", wav[8], wav[9], wav[10], wav[11]);
+  printf(" fmt: %c%c%c%c\n", wav[12], wav[13], wav[14], wav[15]);
+  printf("wFormatLength: %d\n",   *((int32_t *) &wav[16]));
+  printf("wFormatTag: %d\n",      *((int16_t *) &wav[20]));
+  printf("nChannels: %d\n",       *((int16_t *) &wav[22]));
+  printf("nSamplesPerSec: %d\n",  *((int32_t *) &wav[24]));
+  printf("nAvgBytesPerSec: %d\n", *((int32_t *) &wav[28]));
+  printf("nBlockAlign: %d\n",     *((int16_t *) &wav[32]));
+  printf("wBitsPerSample: %d\n",  *((int16_t *) &wav[34]));
+  printf("ov_data: %c%c%c%c\n", wav[36], wav[37], wav[38], wav[39]);
+  printf("ov_datasize: %d\n",     *((int32_t *) &wav[40]));
+}
+
 // readline

 #include <readline/readline.h>
@@ -92,8 +115,12 @@
   return(-1);
 }

+#define    MODEL       "../../model"
+#define    OPENJTALK_DIC   "../open_jtalk_dic_utf_8-1.11"
+#define    OUTPUT_WAV_NAME "audio.wav"
+
 int
-main()
+main(int argc, char *argv[])
 {
   char *line = NULL;
   int n;
@@ -101,9 +128,16 @@
   SharevoxResultCode result;
   int64_t speaker_id = 0;
   int output_binary_size = 0;
-  uint8_t *output_wav = nullptr;
+  uint8_t *output_wav = NULL;

-  init();
+  char *model = MODEL;
+  char *dic = OPENJTALK_DIC;
+
+  if (argc > 1) {
+    model = argv[1];
+  }
+
+  init(model, dic);

   while (1) {
     line = readline("> ");
@@ -120,17 +154,29 @@
             break;
       }
     }
+
     if (n == 3) {
-      printf("[ja] %s\n", line);
       if (generate(line,
                    speaker_id,
                    &output_binary_size,
                    &output_wav) < 0) exit(1);
-      if (save(OUTPUT_WAV_NAME, output_wav, output_binary_size) < 0) exit(1);
-      sharevox_wav_free(output_wav);
+      if (output_wav != NULL) play(output_wav, output_binary_size);
+      //printf("# %d bytes\n", output_binary_size);
+    } else if (n == 1) {
+      if (strcmp(line, "save") == 0) {
+        if (save(OUTPUT_WAV_NAME, output_wav, output_binary_size) < 0) exit(1);
+        sharevox_wav_free(output_wav);
+         output_wav = NULL;
+      } else if (strcmp(line, "show") == 0) {
+        if (output_wav != NULL) show(output_wav, output_binary_size);
+      } else if (strcmp(line, "p") == 0 ||
+        strcmp(line, "play") == 0) {
+   if (output_wav != NULL) play(output_wav, output_binary_size);
+      }
     } else {
       printf("[%d] %s\n", n, line);
     }
+
     add_history(line);
     free(line);
   }
$ 

追加した内部コマンドについては後述します。

play.cpp

さて、本稿のホットポイントの play.cpp です。 関数 play はOpenAL を使って WAVデータを再生する関数です。 関数の前半では WAVヘッダーから情報を取り出し、 後半では OpenAL で再生しています。

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

#include <OpenAL/al.h>
#include <OpenAL/alc.h>

#define WAVH_HEADER_SIZE 44
#define WAVH_CHANNELS_MONO 1
#define WAVH_CHANNELS_STEREO 2
#define WAVH_SAMPLINGRATE_CD 44100
#define  WAVH_BITSPERSAMPLE8 8
#define  WAVH_BITSPERSAMPLE16 16

ALenum getFormat(int wavChannels,  int wavBit)
{
    ALenum format;
    if(wavChannels == WAVH_CHANNELS_MONO){
        if(wavBit == 8) {
            format = AL_FORMAT_MONO8;
        }else if(wavBit == 16) {
            format = AL_FORMAT_MONO16;
        }
    }else if(wavChannels == WAVH_CHANNELS_STEREO){
        if(wavBit== 8){
            format = AL_FORMAT_STEREO8;
        }else if(wavBit == 16) {
            format = AL_FORMAT_STEREO16;
        }
    }
    return format;
}

typedef struct tag_wav_header {   
    int RIFF;                // 'R','I','F','F'                
    int size;                   // size of wave file from here on
    int WAVE;             // 'W','A','V','E'
    int fmt;            //'f','m','t',' '
    int   wFormatLength;          // The length of the TAG format    
    short    wFormatTag;             // should be 1 for PCM type ov_data  
    short    nChannels;              // should be 1 for MONO type ov_data
    int   nSamplesPerSec;         // should be 11025, 22050, 44100  
    int   nAvgBytesPerSec;        // Average Data Rate              
    short    nBlockAlign;            // 1 for 8 bit ov_data, 2 for 16 bit
    short    wBitsPerSample;         // 8 for 8 bit ov_data, 16 for 16 bit
    int ov_data;                // 'd','a','t','a'                        
    int   ov_datasize;               // size of ov_data from here on              

  unsigned char data[0];
} wav_header ;

const int   WAVH_RIFF = 0x46464952; // "RIFF"
const int   WAVH_WAVE =  0x45564157; // "WAVE"
const int   WAVH_FMT = 0x20746D66; // "'fmt"
const int   WAVH_OV_DATA = 0x61746164;    // "ov_data"
const int   WAVH_WFORMATLENGTH = 16;
const short WAVH_WFORMATTAG_PCM = 1;

void
play(uint8_t *output, int size)
{
  wav_header *hp = (wav_header *) output;

  printf("### play\n");
  //printf("RIFF: 0x%x\n", hp->RIFF);
    if (hp->RIFF != WAVH_RIFF) {
        printf("NOT match riff\n");
    return;
  }
    //printf("size: %d\n", hp->size);
  //printf("WAVE: 0x%x\n", hp->WAVE);
    if (hp->WAVE != WAVH_WAVE) {
        printf("NOT match wave\n");
        return;
    }
  //printf(" fmt: 0x%x\n", hp->fmt);
    if (hp->fmt != WAVH_FMT) {
        printf("NOT match fmt\n");
        return;
    }
    //printf("wFormatLength: %d\n", hp->wFormatLength);
    //printf("wFormatTag: %d\n", hp->wFormatTag);
  if (hp->wFormatTag != WAVH_WFORMATTAG_PCM) {
    printf("wFormatTag should be 1\n");
    return;
  }  

    short wavchannels   = hp->nChannels;
    // nSamplesPerSec(サンプリング周波数)と
    // nAvgBytesPerSec(1秒あたりのバイト数)の違いを説明
    printf("hp->nSamplesPerSec: %d \n", hp->nSamplesPerSec);
    printf("hp->nAvgBytesPerSec: %d \n", hp->nAvgBytesPerSec);
    int   samplesPerSec = hp->nSamplesPerSec;
  int   byteParSec    = hp->nAvgBytesPerSec;
    //printf("byteParSec: %d \n", byteParSec);
  short blockAlign    = hp->nBlockAlign;
    //printf("blockAlign: %d \n", blockAlign);
  short bitsParSample = hp->wBitsPerSample;
    //printf("bitsParSample: %d \n", bitsParSample);
    
  printf("ov_datasize: %d\n", hp->ov_datasize);
  //printf("ov_data: 0x%x\n", hp->ov_data);
  if (hp->ov_data != WAVH_OV_DATA) {
        printf("NOT match ov data\n");
      return;
  }

  int wavChannels     = wavchannels;
  int wavBit          = bitsParSample;
  int wavSize         = hp->ov_datasize;
  int wavSamplingrate = samplesPerSec;

  printf("wavChannels: %d \n", wavChannels);
    printf("wavBit: %d \n", wavBit);
    printf("wavSize: %d \n", wavSize);
    printf("wavSamplingrate: %d \n", wavSamplingrate);

  //int time_playback = (float)wavSize / (float)(4*wavSamplingrate);
    int playback_ms = ((float)wavSize / (float)byteParSec) * 1000.0F;
    printf("playback_ms: %d msec \n", playback_ms);
    unsigned char *data = hp->data;

    ALuint source;
    ALuint buffer;
  ALCdevice *device = alcOpenDevice(NULL);
    if (!device) { printf("alcOpenDevice Faild\n"); return; }
    ALCcontext *context = alcCreateContext(device, NULL);
    if (!context) { printf("alcCreateContext Faild\n"); return; }

    alcMakeContextCurrent(context);
    alGenSources (1, &source);
    alGenBuffers(1, &buffer);

    ALenum format = getFormat(wavChannels,  wavBit);
    alBufferData(buffer, format, data, wavSize, wavSamplingrate);
    alSourcei(source, AL_BUFFER, buffer);
    alSourcePlay(source);

    //printf("alSourcePlay \n");
    int time_count; 
    for (time_count = playback_ms; time_count > 0; time_count--) {
        usleep(1000);
    }

    alDeleteBuffers(1, &buffer);
    alDeleteSources(1, &source);
}

OpenALOpenGL と よく似たインターフェースなんだそうですが、 要は関数 alSourcei でPCMデータ(WAVデータ)を ハードウェアにセットし、 関数 alSourcePlay で音声再生をキックする… デバイスドライバーみたいなコードを書くようです。 音声再生自体はハードウェアで実行されるのですが、 ソフトウェアから見れば バックグラウンドで 実行されているように見えます。 この時、ソフトウェアは データの再生時間を計算して ウェイトループに入ります。 再生時間が過ぎると 関数 alDeleteBuffers をコールして ハードウェアの音声再生を停止します。

で、前述のオリジナル・サンプルの 問題点ですが、ひとつは nSamplesPerSec(サンプリング周波数)とnAvgBytesPerSec(1秒あたりのバイト数) の意味を取り違えてるように思える事、 もうひとつは再生時間の単位を1秒にしている事です。 そのためオリジナル・サンプルのコードのままだと WAVデータを最後まで再生せずに 処理を終了してしまいます。 (つまり尻切れトンボ状態になります) そこで再生待ちのループをミリ秒単位に変更しました。 音声の場合、ミリ秒ぐらいまで 人間は聞き分けてしまいますからね。


ビルドと実行

ビルドの手順は 昨日の記事 と変わりません。

$ cd sharevox_core-0.1.2/t2s/
$ ls
CMakeLists.txt          play.cpp
model               t2s.cpp
open_jtalk_dic_utf_8-1.11
$ rm -rf build
$ mkdir build
$ cd build
$ cmake ..
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_CXX_FLAGS: -Wno-deprecated-declarations -Wno-writable-strings
-- PARENT: /Users/fujita/xtr/BookBot/BookBot3/05_T2S_OpenAL
-- TOP_DIR: /Users/fujita/xtr/BookBot/BookBot3/05_T2S_OpenAL/sharevox_core-0.1.2
-- CORE_LIB: /Users/fujita/xtr/BookBot/BookBot3/05_T2S_OpenAL/sharevox_core-0.1.2/core/lib/libcore.dylib
-- OPENAL_DIR: /usr/local/opt/openal-soft
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/fujita/xtr/BookBot/BookBot3/05_T2S_OpenAL/sharevox_core-0.1.2/t2s/build
maverick:build fujita$ cmake --build .
[ 33%] Building CXX object CMakeFiles/t2s.dir/t2s.cpp.o
[ 66%] Building CXX object CMakeFiles/t2s.dir/play.cpp.o
[100%] Linking CXX executable t2s
[100%] Built target t2s
$ 

但し、t2s ディレクトリには SHAREVOX の公式リリースに 添付されている model ディレクトリも配置しました*3。この公式リリースの model ディレクトリには 4キャラクターの声が格納されています。

次に実行方法なんですが…

昨日の記事 でも説明したように、 起動後は初期化処理のため20秒弱待たされます。 また内部コマンドは1バイト文字(=英字)、 3バイト文字(≒漢字)は発話テキストと 認識されることは変わりません。

さらにこのバージョンでは次の model を選択できるようにしました。 コマンド起動時に第1引数として model ディレクトリのパスを受け付けます。 デフォルト(引数なし)では "../../model" が指定されます。 上記の build ディレクトリからだと "sharevox_core-0.1.2/model" が指定され SHAREVOX core に付属する 男性の声のみが収録されています。 引数に "../model" を指定すると "sharevox_core-0.1.2/t2s/model" 前述のSHAREVOX公式リリースの 4声が発声できるようになります。

音が聞こえないので あまり意味はないですが コマンドのログは以下のとおりです。

$ ./t2s
model: ../../model
coreの初期化に成功しました
dic: ../open_jtalk_dic_utf_8-1.11
終了
> こんにちは
音声生成中...終了: 69504 bytes
### play
hp->nSamplesPerSec: 48000
hp->nAvgBytesPerSec: 96000
ov_datasize: 69460
wavChannels: 1
wavBit: 16
wavSize: 69460
wavSamplingrate: 48000
playback_ms: 723 msec
> q
exit
$ ./t2s ../model
model: ../model
coreの初期化に成功しました
dic: ../open_jtalk_dic_utf_8-1.11
終了
> こんにちは
音声生成中...終了: 69848 bytes
### play
hp->nSamplesPerSec: 48000
hp->nAvgBytesPerSec: 96000
ov_datasize: 69804
wavChannels: 1
wavBit: 16
wavSize: 69804
wavSamplingrate: 48000
playback_ms: 727 msec
> q
exit
$ 



…ということで

ようやく t2s を喋らせることができました。 明日は t2s の最後のお色直しとして、 model ディレクトリに収録されている キャラクターの一覧を表示する機能などを 追加します。 あと、t2s が動いている動画も 貼り付けるよう頑張ってみるつもりです。

それではお約束の…

#つくよみちゃんを利用してフォロワー増やしたい

以上

*1:付属のメモランダムから拾い出した URL は次のページでした。

tips.hecomi.com

こちらはオリジナルの OpenJTalk+HTS を対象にしているようです。

*2:どういう事情かよく知りません。

*3:以前、紹介したと思いますが、 次の Github の SHAREVOX 0.1.0 のリポジトリ

github.com

…に格納されている sharevox_model-0.1.0.zip というZIPファイルです。

このファイルを解凍すると model ディレクトリが生成されますので sharevox_core-0.1.2/t2s/ に格納してください。

SHAREVOX core の API を探る(2)ReadLine

Explore the SHAREVOX core API (2) ReadLine


2022/12/20
藤田昭人


5日間連続投稿の2回目、 今回はテクニカル(?)なトピックから始めます。

実はこの春先まで僕は、 音声合成を含む機械学習アルゴリズムの実行には GPU を使った実行環境が必須だと思い込んでいました。 なので昨年、シンデレラの童話読み聞かせを作ったときも Chrome で標準的に使える Web Speech API を迷わず使っていました。 噂によればこの API は 裏で Google音声認識音声合成が 動いているのだとか… 「まぁ、そう言うもんなんだろう」 という認識だったのです。 っていうかぁ… 無料の割には音声認識の精度が高かったので 結構満足していた訳で、 難点はブラウザ内蔵のAPIの面倒くささ*1と、 あと iPhone では音声認識が動かない*2ぐらいかな? と思っていたのです。

ところが、 夏の椎間板ヘルニアで 寝たきりになっている時期、 本当にやれることが無くて 暇つぶしに スマホ相手にググりまくっている時期に たまたま見つけたのが VOICEVOX だった訳です*3

…って語ってると 明日のマクラがなくなるので、 本日はこの辺で止めて 本題に入ります。


【注】昨日の diff に誤りがありました

昨日の記事 の simple_tts.cpp の修正箇所に漏れがありました。 正しくはこちら。

$ diff -u ../example/cpp/unix/simple_tts.cpp simple_tts.cpp
--- ../example/cpp/unix/simple_tts.cpp  2022-10-28 17:21:34.000000000 +0900
+++ simple_tts.cpp  2022-12-20 13:35:13.000000000 +0900
@@ -2,7 +2,7 @@
 #include <iostream>
 #include <string>

-#include "../../../core/src/core.h"
+#include "../core/src/core.h"

 #define OUTPUT_WAV_NAME "audio.wav"

@@ -17,7 +17,7 @@

   std::cout << "coreの初期化中..." << std::endl;

-  if (!initialize("../../../model", false)) {
+  if (!initialize("../model", false)) {
     std::cout << "coreの初期化に失敗しました" << std::endl;
     return 1;
   }
# 

修正前のコードだと model ディレクトリのパスが違うので初期化でコケます。
それから OpenJTalk の辞書も simple_tts ディレクトリに コピーしておく必要があります。

関連ファイルが正しく配置できると…

$ ls
CMakeLists.txt          open_jtalk_dic_utf_8-1.11
build               simple_tts.cpp
maverick:simple_tts fujita$ ./build/simple_tts 'こんにちは'
coreの初期化中...
openjtalk辞書の読み込み中...
音声生成中...
音声ファイル保存中...
音声ファイル保存完了 (audio.wav)
maverick:simple_tts fujita$ ls
CMakeLists.txt          open_jtalk_dic_utf_8-1.11
audio.wav           simple_tts.cpp
build
$ 

見てのとおり audio.wav が生成されます。


Simple_TTS は遅い

さて、 この simple_tts は WAV ファイルを生成するだけ (再生はしてくれない) のも困りものですが、 とにかく実行が遅い。

実行時間を測ってみると…

$ time -p ./build/simple_tts 'こんにちは'
coreの初期化中...
openjtalk辞書の読み込み中...
音声生成中...
音声ファイル保存中...
音声ファイル保存完了 (audio.wav)
real 18.64
user 18.95
sys 0.40
$ 

なんと 18 秒もかかっています。 「ひょっとして初期化がノロいのでは?」 と考えたので次のようなプログラムを 書いてみました。

$ cat c.cpp
#include "../core/src/core.h"

int
main()
{
  initialize("../model", false);
  finalize();
}
$ g++ -o ccc c.cpp -Wl,-rpath,../core/lib ../core/lib/libcore.dylib
ld: warning: dylib (../core/lib/libcore.dylib) was built for newer macOS version (11.7) than being linked (11.0)
$ time -p ./ccc
real 18.88
user 17.97
sys 0.38
$ 

このプログラムは初期化処理(initialize)と 終了処理(finalize)だけを実行する2行のプログラムです。 ld コマンドが出力する waring は忘れてもらうとして…

どうやら simple_tts がノロいのは model ファイルを取り込む 初期化処理に非常に時間がかかっているようです。 言い換えれば WAVファイルを生成する sharevox_tts の実行はそれほど時間を要しない。

であれば…

起動時に初期化処理を行い、 その後は対話形式で text-to-speach を実行する 対話型のプログラムを作れば良いことになります。


コマンド t2s

…という事で、 simple_tts にちょこっとコードを追加して 対話型のコマンドにすることにしました。 名付けて t2s 。もちろん爺さん趣味です😁

GNU ReadLine

対話型インターフェースといえば GNU ReadLine です。詳細は Wikipedia を見てもらうとして…

ja.wikipedia.org

要はシェルのライン・エディティング機能を 提供してくれるライブラリーでして、 今回のように UTF-8 のコード入力が必須の場合 これをかました方が安全なんです。 ヒストリー機能も使えるしね。

Mac の場合、 インストールはホームブリューを使うのが 一番お手軽です。次のページに簡単な解説が 書いてあるので見てもうとして…

qiita.com

このページに掲載されている サンプルコードと simple_tts.cpp を ドッキングすることにしました。 (詳細は後述の「ソースコード」の項を参照)


CMakeLists.txt

コマンド t2s のディレクトリは 昨日の記事 の simple_tts ディレクトリの隣におくことにしました。 なので CMakeLists.txt は昨日作成したものをちょいと修正するだけです。

$ diff -u CMakeLists.txt.orig CMakeLists.txt
--- CMakeLists.txt.orig 2022-12-19 10:33:15.000000000 +0900
+++ CMakeLists.txt  2022-12-20 15:01:02.000000000 +0900
@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.16)
-project(SimpleTTS)
+project(T2S)
 set(CMAKE_CXX_STANDARD 11)

 find_path(PARENT NAMES "sharevox_core-0.1.2" PATHS "../..")
@@ -9,5 +9,5 @@
 find_library(CORE_LIB NAMES core PATHS "${TOP_DIR}/core" PATH_SUFFIXES lib)
 message(STATUS "CORE_LIB: ${CORE_LIB}")

-add_executable(simple_tts simple_tts.cpp)
-target_link_libraries(simple_tts ${CORE_LIB})
+add_executable(t2s t2s.cpp)
+target_link_libraries(t2s ${CORE_LIB} readline)
$ 

名前を simple_tts から t2s に変更し、 target_link_libraries に readline を追加しました。


ソースコード

ソースコード t2s.cpp はこちら。

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "../core/src/core.h"

#define MODEL       "../../model"
#define OPENJTALK_DIC   "../open_jtalk_dic_utf_8-1.11"
#define OUTPUT_WAV_NAME "audio.wav"

void
init()
{
  SharevoxResultCode result;

  if (!initialize(MODEL, false)) {
    printf("coreの初期化に失敗しました\n");
    exit(1);
  } else {
    printf("coreの初期化に成功しました\n");
  }

  printf("openjtalk辞書の読み込み中...");
  result = sharevox_load_openjtalk_dict(OPENJTALK_DIC);
  if (result != SHAREVOX_RESULT_SUCCEED) {
    printf("\n%s\n", sharevox_error_result_to_message(result));
    exit(1);
  } else {
    printf("終了\n");
  }
}

int
generate(const char *text, int64_t speaker, 
         int *output_size, uint8_t **output)
{
  SharevoxResultCode result;

  printf("音声生成中...");
  result = sharevox_tts(text, speaker, output_size, output);
  if (result != SHAREVOX_RESULT_SUCCEED) {
      printf("\n%s\n", sharevox_error_result_to_message(result));
      return(-1);
  }
    printf("終了: %d bytes\n", *output_size);
  return(0);
}

int
save(const char *name, uint8_t *output, int size)
{
  FILE* fp;

  printf("音声ファイル保存中...");
  fp = fopen(name, "wb");
  if (fp == NULL){
      printf("失敗\n");
      return(-1);
  }

  if (fwrite(output, size, 1, fp) < 1 ){
      printf("ファイルへの書き込みに失敗しました。\n");
      return(-1);
  }

  fclose(fp);
  printf("音声ファイル保存完了 (%s)\n", name);
  return(0);
}

void
term()
{
  finalize();
}


// readline

#include <readline/readline.h>
#include <readline/history.h>

int
numMB(char *str)
{
  if ((*str & 0x80) == 0x00) return(1);
  if ((*str & 0xE0) == 0xC0) return(2);
  if ((*str & 0xF0) == 0xE0) return(3);
  if ((*str & 0xF8) == 0xF0) return(4);
  if ((*str & 0xFC) == 0xF8) return(5);
  if ((*str & 0xFE) == 0xFC) return(6);
  return(-1);
}

int 
main()
{
  char *line = NULL;
  int n;

  SharevoxResultCode result;
  int64_t speaker_id = 0;
  int output_binary_size = 0;
  uint8_t *output_wav = nullptr;
  
  init();

  while (1) {
    line = readline("> ");
    if (line == NULL || strlen(line) == 0) {
      free(line);
      continue;
    }
    n = numMB(line);
    if (n == 1) {
      if (strcmp(line, "q") == 0 ||
          strcmp(line, "quit") == 0 ||
          strcmp(line, "exit") == 0) {
            free(line);
            break;
      }
    }
    if (n == 3) {
      printf("[ja] %s\n", line);
      if (generate(line, 
                   speaker_id,
                   &output_binary_size,
                   &output_wav) < 0) exit(1);
      if (save(OUTPUT_WAV_NAME, output_wav, output_binary_size) < 0) exit(1);
      sharevox_wav_free(output_wav);
    } else {
      printf("[%d] %s\n", n, line);
    }
    add_history(line);
    free(line);
  }

  printf("exit\n");
  term();
  exit(0);
}

前述のとおり、 サンプルコードと simple_tts.cpp を シンプルにドッキングした内容です。 ミソは int numMB(char *str) なる関数。 この関数はマルチバイト文字のバイト数を判定します。 返り値が1なら1バイト文字(=英字)、 返り値が3なら3バイト文字(≒漢字)で、 t2s の対話インターフェースでは 3バイト文字から始まる文字列はWAVファイルを生成するテキスト、 1バイト文字から始まる文字列は t2s の内部コマンドと判定しています。 もっとも、このコードでは内部コマンドは exit/quit/q の1つだけです。


ビルドと実行

トップディレクトリの直下に t2s ディレクトリを作成し、 上記の open_jtalk_dic_utf_8-1.11 と CMakeLists.txt と t2s.cpp を作成したら、 昨日の記事 とほぼ同様の手順でビルドができます。

$ rm -r build
$ mkdir build
$ cd build/
$ cmake ..
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- PARENT: /Users/fujita/xtr/BookBot/BookBot3/04_T2S_ReadLine
-- TOP_DIR: /Users/fujita/xtr/BookBot/BookBot3/04_T2S_ReadLine/sharevox_core-0.1.2
-- CORE_LIB: /Users/fujita/xtr/BookBot/BookBot3/04_T2S_ReadLine/sharevox_core-0.1.2/core/lib/libcore.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/fujita/xtr/BookBot/BookBot3/04_T2S_ReadLine/sharevox_core-0.1.2/t2s/build
$ cmake --build .
[ 50%] Building CXX object CMakeFiles/t2s.dir/t2s.cpp.o
[100%] Linking CXX executable t2s
[100%] Built target t2s
$ 
$ ./t2s
coreの初期化に成功しました
openjtalk辞書の読み込み中...終了
> こんにちは
[ja] こんにちは
音声生成中...終了: 69504 bytes
音声ファイル保存中...音声ファイル保存完了 (audio.wav)
> q
exit
$ 



予想したとおり、一度 initialize を実行して model をロードすると、 sharevox_tts の実行は短時間です。 が、やはり WAV ファイルの再生機能がないと t2s コマンドは役に立ちそうにありません。

明日は WAV ファイルの再生機能を紹介します。

それではお約束の…

#つくよみちゃんを利用してフォロワー増やしたい

以上

*1:クラッキング防止のためなんだそうですが…

*2:Apple vs Google の構図なんでしょうかね?

*3:正直に答えましょう。 僕が見たのはこちら…

www.youtube.com

そもそもニコ動に縁のなかった僕には この手の動画は当然ノーマークで… だって、こんなところから テクニカルな情報を拾えるなんて思ってなかったもん。

でも…

結局これが 「唯一ヘルニアになって良かったこと」 になりました😀