• ベストアンサー
※ ChatGPTを利用し、要約された質問です(原文:Perlについて教えてください!)

Perlについて教えてください!

このQ&Aのポイント
  • Perlについて教えてください!入力ファイルには英文で例えば、Mr. Obama concluded in his first year that the Bush-era dream of remaking Afghanistan was a fantasy, and that the far greater threat to the United States was an unstable, nuclear-armed Pakistan. So he narrowed the goals in Afghanistan, and narrowed them again, until he could make the case that America had achieved limited objectives in a war that was, in any traditional sense, unwinnable.
  • The lessons Mr. Obama has learned in Afghanistan have been crucial to shaping his presidency. Fatigue and frustration with the war have defined the strategies his administration has adopted to guide how America intervenes in the world’s messiest conflicts. Out of the experience emerged Mr. Obama’s “light footprint” strategy, in which the United States strikes from a distance but does not engage in years-long, enervating occupations. That doctrine shaped the president’s thinking about how to deal with the challenges that followed — Libya, Syria and a nuclear Iran.
  • We started with what everyone thought was a pragmatic vision but, at its core, was a plan for changing the way Afghanistan is wired. We ended up thinking about how to do as little wiring as possible.

質問者が選んだベストアンサー

  • ベストアンサー
  • salsberry
  • ベストアンサー率69% (495/711)
回答No.3

1行1文ならばとりあえずどうやって文単位で分割するかは考えないで済みます。 一番簡単なのは、入力ファイルを2回読むことです。1回目は全部で何行(何文)あるかを数えるだけ、その結果を使って先頭から10%と末尾から10%にあたる行(文)を別のファイルに書き出すのが2回目。 入力ファイルを1回しか読んではいけないという条件がつくと少々面倒になりますし、先頭から10%の出力を行うのに必要なメモリ量が膨れあがります。

全文を見る
すると、全ての回答が全文表示されます。

その他の回答 (2)

  • dscripty
  • ベストアンサー率51% (166/325)
回答No.2

英文をロジックだけで、厳密に文に分割することが、まず不可能だよ! 文末のピリオドなのか、略語のピリオドなのかすら、略語リストがないとできない。 略語と固有名詞の組み合わせなのか、略語の文末と文頭の組み合わせなのかの判定は、もっと難しくて、単語と品詞の対応辞書をもとに、推測しながら文法に単語をあてはめて、文末判定しなければならないとおもうよ? 文の10%じゃなくて、単語の10%なら空白で分割されてるから、簡単だとおもう。

全文を見る
すると、全ての回答が全文表示されます。
  • salsberry
  • ベストアンサー率69% (495/711)
回答No.1

要求仕様が曖昧ですな。 ・「前半の10%と最後から10%」はどのように数えるのか? 文字数、単語数、文数、その他、どの方法で数えた場合の10%? ・文字数や単語数で数えて10%の場合、出力は単語や文の途中で切れてもいい? ・文の数で数えて10%の場合、文の数が5しかないとか、17あったという場合にはどれだけ出力すればいい? 質問文にある文章は文が9つありますが、先頭と最後の10%はそれぞれどこからどこまででしょうか?

wiredrikou
質問者

補足

質問文が不明瞭ですみませんでした。 前半10%と後半10%の抽出条件は例えば123行の内の頭から10%と終わりから10%を文の数で計算して、123行の10%は12.3行となるのでこのような場合には四捨五入により12行にして抽出する方法でお願いします。また、これも質問文には記載されていませんでしたが全ての行は一文ずつ改行されている状態での実行を想定しています。

全文を見る
すると、全ての回答が全文表示されます。

関連するQ&A

  • VOA OBAMA

    Sitting with the Chinese leader in Honolulu, Mr. Obama called cooperation with China vital, adding that despite differences, they would discuss how to re-balance growth and ensure there is a "win-win" trading relationship. (1)辞書を引くと call for cooperation withで~の協力を要請する とありますが、forが抜けてるのでしょうか? (2)China vital とは何でしょうか? よろしくお願いします。

  • 日本語に訳してください

    文が途中からなんですがお願いします(´>ω<`) It was one of the mort moving experience I've ever had. After the concert,I joined his taiko workshop. Mr. Hayashi and I talked a lot. He was born in Hiroshima in 1952. From 1971 to 1981,he played the taiko as a member of a group. In 1982,he started to perform as soloist. Mr. Hayashi created an original way of playing the taiko. With his unique combination of taiko drums,he can make a rich sound even when plays by himself, In 1948,he made his debut at Carnegie Hall. That was the first taiko soloist performance seen there. Since then he has performed around the world. Now I'm learning how to play the taiko with a taiko group in Dublin. Mr. Hayashi instructed us when he was here. I want to learn the taiko in Japan someday .

  • 和訳をよろしくお願いします

    Furthermore, in August 2009, Mr. So-and-so began a campaign against a McDonald’s Japan advertisement featuring a burger mascot named Mr. James. His grievance was that Mr. James perpetuates negative stereotypes about non-Japanese Caucasian minorities living in Japan.

  • 日本語に訳して欲しいです

    I am Capt Ken Anderson a United States solider in Afghanistan. I was married before but my wife is late and i am left with my little daughter who is in USA under the care of a nanny. i am 46 years and i wish to have a good relationship with you.bye please send me email

  • 和訳をお願いします。

    The Afghanistan decision was a big deal; if it went wrong, we were cooked on national security. It didn't. Mr. Obama's decision to support Gen. Stanley McCrystal's counterinsurgency plan in Afghanistan was a procedural mess but arrived at the right result. この文章の中の次の部分の意味が分かりません。 「we were cooked on national security」 どなたか教えて頂けませんか。

  • 日本語に訳してください!

    John Watson was having another nightmare. It was always the same - guns firing , bombs exploding and army officers shouting orders to their men. As usual , the terrible feeling that any moment might be his last. Jhon woke up , breathing hard , and stared into the darkness of his small flat. His mind took several long seconds to realise that he was no longer in Afghanistan - his days in the army were over now.

  • facts on the ground

    President-elect Obama may have hoped he would have time to develop an approach to peacemaking in the Holy Land. But as usual, the schedule is dictated by facts on the ground. It is unclear how engaged Obama can be in the Middle East in the early months of his administration; his first priority will be fixing the American economy. What Obama can't delay once he takes office is forcefully recommitting the United States to a two-state solution and the basic framework for peace that already exists. イスラエルパレスチナ問題の記事です。 2行目の facts on the groundは 目の前にある問題(アメリカ国内の問題)でスケジュールはいっぱいになっている という意味にとってよいのでしょうか。 宜しくお願いします(´_`。)

  • 翻訳おねがいします

    なんとなくわかるんですが、文章の意味を明確にしりたいのでお願いします。 In May at Hiroshima, he cited the suffering caused by the atomic bombs. This communicated more than Mr. Obama’s concerns about nuclear weapons. It signaled that Washington understands Japan’s needs and will commit resources to meet them — in this case, a presidential visit that risked domestic blowback. This could help convince Tokyo that it can count on American support when it comes to, say, naval confrontations with China. Professor Lind stressed that none of Mr. Obama’s comments constitute apology. But nor is the controversy around them without substance. Rather, these speeches touch on a longstanding domestic political divide over the nature of American power. “It gets back to this issue of national identity,” she said. Some Americans, including Mr. Obama, emphasize democratic ideals of humility and self-critique. Others believe American power is rooted in unity, celebration of positive deeds and shows of strength. “Democracies have to have the courage to acknowledge when we don’t live up to the ideals that we stand for,” Mr. Obama said in March in Argentina, referring to a 1976 military coup that had received tacit American approval. “The United States, when it reflects on what happened here, has to examine its own policies, as well, and its own past.” ネタ元 Obama, Acknowledging U.S. Misdeeds Abroad, Quietly Reframes American Power http://www.nytimes.com/2016/09/08/world/americas/obama-acknowledging-us-misdeeds-abroad-quietly-reframes-american-power.html

  • このwho wasが省略できない理由は?

    A soldier who was almost killed in Afghanistan is vowing to return to Army service despite his serious injuries. を、 A soldier almost killed in Afghanistan is vowing to return to Army service despite his serious injuries. と、しては、いけないようです。 何故なのでしょうか? よろしくお願い致します。

  • 英文解釈(高校1年)教えてください

    Einstein's pacifism was something he did little to hide.He spoke and wrote extensively against the way militaristic governments dealt with the problem of war,and condemned these governments for saying they were protecting their countries.Einstein argued that "you cannot simultaneously prevent and prepare for war.The prevention of war requires more faith,courage and resolution than is needed to prepare for war." The contributions Einstein ( 1 ) in the field of science are undeniable.In a century dominated by science,he was the dominant scientist.His discoveries and theories created a movement away from passive experimentation into a more profound method of thinking.This led to (2)[his theory of relativity];that the world was not as it seemed.Yet ( 3 ) all the advances in modern thinking that were brought on by Einstein,one thought remains true;science was Einstein's work,but pacifism was his life. 上の英文の(2)[his theory of relativeity]を生むきっかけとなった当時の科学界の動向はどんなものだったか。日本語で簡潔に答えよ。 という問題です。 その前にある from passive experimentation into a more profound method of thinking の passive experimentation の部分がそれに相当するのかなと思いますが、この前後の文章の意味するところが辞書で調べてもいまいちつかめず、どのようなことばで表現すれば適当なのかわかりません。 解説よろしくお願いします。

このQ&Aのポイント
  • MFC-L3770CDWの印刷面に黄色の斑点ができる問題が発生しています。最初はドラムの清掃で解消しましたが、再発しています。印刷は主にPowerpointの配布資料です。
  • MFC-L3770CDWのドラムが汚れて印刷面に黄色の斑点ができるトラブルが起きています。最初はドラムの清掃で問題が解決しましたが、再発しています。主にPowerpointの配布資料を印刷しています。
  • MFC-L3770CDWの印刷面が黄色い斑点で汚れる問題が発生しており、ドラムの清掃後も再発しています。主にPowerpointの配布資料を印刷しています。ドラムやトナーの交換が必要かどうか教えてください。
回答を見る

専門家に質問してみよう