সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
টেনসরফ্লো :: অপস:: ইউনিকোড ট্রান্সকোড
#include <string_ops.h>
একটি উৎস এনকোডিং থেকে একটি গন্তব্য এনকোডিং এ ইনপুট পাঠ্য ট্রান্সকোড করুন।
সারাংশ
ইনপুট হল যেকোনো আকৃতির একটি স্ট্রিং টেনসর। আউটপুট হল একই আকৃতির একটি স্ট্রিং টেনসর যাতে ট্রান্সকোড করা স্ট্রিং থাকে। আউটপুট স্ট্রিং সবসময় বৈধ ইউনিকোড. যদি ইনপুটে অবৈধ এনকোডিং পজিশন থাকে, তাহলে errors
অ্যাট্রিবিউট তাদের মোকাবেলা করার নীতি নির্ধারণ করে। যদি ডিফল্ট ত্রুটি-হ্যান্ডলিং নীতি ব্যবহার করা হয়, তাহলে আউটপুটে অবৈধ বিন্যাস প্রতিস্থাপন করা হবে replacement_char
দ্বারা। যদি ত্রুটি নীতি ignore
করা হয়, ইনপুটে কোনো অবৈধ এনকোডিং অবস্থান এড়িয়ে যাওয়া হয় এবং আউটপুটে অন্তর্ভুক্ত করা হয় না। যদি এটি strict
সেট করা হয় তবে কোনো অবৈধ বিন্যাস একটি InvalidArgument ত্রুটির কারণ হবে৷
এই ক্রিয়াকলাপটি output_encoding = input_encoding
এর সাথে ব্যবহার করা যেতে পারে ইনপুটগুলির জন্য সঠিক বিন্যাস প্রয়োগ করতে এমনকি যদি তারা ইতিমধ্যেই পছন্দসই এনকোডিংয়ে থাকে।
যদি ইনপুটটি এনকোডিং নির্ধারণের জন্য প্রয়োজনীয় বাইট অর্ডার মার্ক দ্বারা প্রিফিক্স করা হয় (যেমন যদি এনকোডিংটি UTF-16 হয় এবং BOM বিগ-এন্ডিয়ান নির্দেশ করে), তাহলে সেই BOM ব্যবহার করা হবে এবং আউটপুটে নির্গত হবে না। যদি ইনপুট এনকোডিং একটি সুস্পষ্ট endianness (যেমন UTF-16-BE) দ্বারা চিহ্নিত করা হয়, তাহলে BOM-কে একটি নন-ব্রেকিং-স্পেস হিসাবে ব্যাখ্যা করা হয় এবং আউটপুটে সংরক্ষণ করা হয় (ইউটিএফ-8-এর জন্য সর্বদা সহ)।
শেষ ফলাফল হল যে যদি ইনপুটটি একটি সুস্পষ্ট endianness হিসাবে চিহ্নিত করা হয় তবে ট্রান্সকোডিং উৎসের সমস্ত কোডপয়েন্টের জন্য বিশ্বস্ত। যদি এটি একটি সুস্পষ্ট endianness সঙ্গে চিহ্নিত না হয়, BOM নিজেই স্ট্রিং এর অংশ হিসাবে বিবেচিত হয় না কিন্তু মেটাডেটা হিসাবে, এবং তাই আউটপুটে সংরক্ষিত হয় না।
যুক্তি:
- স্কোপ: একটি স্কোপ অবজেক্ট
- ইনপুট: প্রসেস করা পাঠ্য। যে কোন আকৃতি থাকতে পারে।
- input_encoding: ইনপুট স্ট্রিং এর টেক্সট এনকোডিং। এটি ICU ucnv অ্যালগরিদমিক রূপান্তরকারী দ্বারা সমর্থিত যেকোন এনকোডিং। উদাহরণ:
"UTF-16", "US ASCII", "UTF-8"
- output_encoding: আউটপুটে ব্যবহার করার জন্য ইউনিকোড এনকোডিং।
"UTF-8", "UTF-16-BE", "UTF-32-BE"
এর একটি হতে হবে৷ মাল্টি-বাইট এনকোডিং বড়-এন্ডিয়ান হবে।
ঐচ্ছিক বৈশিষ্ট্য (দেখুন Attrs
):
- ত্রুটি: ইনপুটে অবৈধ বিন্যাস পাওয়া গেলে ত্রুটি পরিচালনার নীতি। 'কঠোর' মান অপারেশনটিকে যে কোনো অবৈধ ইনপুট বিন্যাসে একটি InvalidArgument ত্রুটি তৈরি করবে। 'প্রতিস্থাপন' (ডিফল্ট) এর একটি মান অপারেশনটিকে ইনপুটে যেকোনো অবৈধ বিন্যাস
replacement_char
কোডপয়েন্ট দিয়ে প্রতিস্থাপন করবে। 'উপেক্ষা' এর একটি মান অপারেশনটিকে ইনপুটে কোনো অবৈধ বিন্যাস এড়িয়ে যেতে এবং কোনো সংশ্লিষ্ট আউটপুট অক্ষর তৈরি করবে না। - রিপ্লেসমেন্ট_চার:
errors='replace'
হলে ইনপুটে কোনো অবৈধ বিন্যাসের জায়গায় প্রতিস্থাপন অক্ষর কোডপয়েন্ট ব্যবহার করা হবে। যেকোনো বৈধ ইউনিকোড কোডপয়েন্ট ব্যবহার করা যেতে পারে। ডিফল্ট মান হল ডিফল্ট ইউনিকোড প্রতিস্থাপন অক্ষর হল 0xFFFD বা U+65533।)
মনে রাখবেন যে UTF-8-এর জন্য, 1 বাইটে প্রকাশযোগ্য একটি প্রতিস্থাপন অক্ষর পাস করা, যেমন ' ', উৎসে স্ট্রিং সারিবদ্ধকরণ সংরক্ষণ করবে কারণ অবৈধ বাইট 1-বাইট প্রতিস্থাপনের সাথে প্রতিস্থাপিত হবে। UTF-16-BE এবং UTF-16-LE-এর জন্য, যেকোনো 1 বা 2 বাইট প্রতিস্থাপন অক্ষর উৎসে বাইট সারিবদ্ধকরণ সংরক্ষণ করবে।
- replace_control_characters: C0 কন্ট্রোল অক্ষর (00-1F)
replacement_char
char দিয়ে প্রতিস্থাপন করা হবে কিনা। ডিফল্ট মিথ্যা.
রিটার্ন:
-
Output
: output_encoding
ব্যবহার করে এনকোড করা ইউনিকোড টেক্সট ধারণকারী একটি স্ট্রিং টেনসর।
পাবলিক বৈশিষ্ট্য
পাবলিক ফাংশন
নোড
::tensorflow::Node * node() const
operator::tensorflow::Input() const
অপারেটর::টেনসরফ্লো::আউটপুট
operator::tensorflow::Output() const
পাবলিক স্ট্যাটিক ফাংশন
ত্রুটি
Attrs Errors(
StringPiece x
)
কন্ট্রোল অক্ষর প্রতিস্থাপন করুন
Attrs ReplaceControlCharacters(
bool x
)
প্রতিস্থাপন চর
Attrs ReplacementChar(
int64 x
)
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-26 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-26 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# tensorflow::ops::UnicodeTranscode Class Reference\n\ntensorflow::ops::UnicodeTranscode\n=================================\n\n`#include \u003cstring_ops.h\u003e`\n\nTranscode the input text from a source encoding to a destination encoding.\n\nSummary\n-------\n\nThe input is a string tensor of any shape. The output is a string tensor of the same shape containing the transcoded strings. [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) strings are always valid unicode. If the input contains invalid encoding positions, the `errors` attribute sets the policy for how to deal with them. If the default error-handling policy is used, invalid formatting will be substituted in the output by the `replacement_char`. If the errors policy is to `ignore`, any invalid encoding positions in the input are skipped and not included in the output. If it set to `strict` then any invalid formatting will result in an InvalidArgument error.\n\nThis operation can be used with `output_encoding = input_encoding` to enforce correct formatting for inputs even if they are already in the desired encoding.\n\nIf the input is prefixed by a Byte Order Mark needed to determine encoding (e.g. if the encoding is UTF-16 and the BOM indicates big-endian), then that BOM will be consumed and not emitted into the output. If the input encoding is marked with an explicit endianness (e.g. UTF-16-BE), then the BOM is interpreted as a non-breaking-space and is preserved in the output (including always for UTF-8).\n\nThe end result is that if the input is marked as an explicit endianness the transcoding is faithful to all codepoints in the source. If it is not marked with an explicit endianness, the BOM is not considered part of the string itself but as metadata, and so is not preserved in the output.\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: The text to be processed. Can have any shape.\n- input_encoding: Text encoding of the input strings. This is any of the encodings supported by ICU ucnv algorithmic converters. Examples: `\"UTF-16\", \"US ASCII\", \"UTF-8\"`.\n- output_encoding: The unicode encoding to use in the output. Must be one of `\"UTF-8\", \"UTF-16-BE\", \"UTF-32-BE\"`. Multi-byte encodings will be big-endian.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/unicode-transcode/attrs#structtensorflow_1_1ops_1_1_unicode_transcode_1_1_attrs)):\n\n- errors: Error handling policy when there is invalid formatting found in the input. The value of 'strict' will cause the operation to produce a InvalidArgument error on any invalid input formatting. A value of 'replace' (the default) will cause the operation to replace any invalid formatting in the input with the `replacement_char` codepoint. A value of 'ignore' will cause the operation to skip any invalid formatting in the input and produce no corresponding output character.\n- replacement_char: The replacement character codepoint to be used in place of any invalid formatting in the input when `errors='replace'`. [Any](/versions/r1.15/api_docs/cc/class/tensorflow/ops/any#classtensorflow_1_1ops_1_1_any) valid unicode codepoint may be used. The default value is the default unicode replacement character is 0xFFFD or U+65533.)\n\n\u003cbr /\u003e\n\nNote that for UTF-8, passing a replacement character expressible in 1 byte, such as ' ', will preserve string alignment to the source since invalid bytes will be replaced with a 1-byte replacement. For UTF-16-BE and UTF-16-LE, any 1 or 2 byte replacement character will preserve byte alignment to the source.\n\n- replace_control_characters: Whether to replace the C0 control characters (00-1F) with the `replacement_char`. Default is false.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): A string tensor containing unicode text encoded using `output_encoding`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [UnicodeTranscode](#classtensorflow_1_1ops_1_1_unicode_transcode_1a7f5400ef43a30cade48ec26babb8d8ac)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, StringPiece input_encoding, StringPiece output_encoding)` ||\n| [UnicodeTranscode](#classtensorflow_1_1ops_1_1_unicode_transcode_1a40d3c0e8ec4a39090a41db687a75e81e)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, StringPiece input_encoding, StringPiece output_encoding, const `[UnicodeTranscode::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/unicode-transcode/attrs#structtensorflow_1_1ops_1_1_unicode_transcode_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_unicode_transcode_1a9121969d40f22188b5468ef3a88c7e85) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_unicode_transcode_1a72ea1928a722003c6a454fb3e4d99cf8) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_unicode_transcode_1a5bd626fd8293b9ba38989e199cb56039)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_unicode_transcode_1aa3ed5d86e608fef6fe501acc1886adc4)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_unicode_transcode_1a228a8c3c53116beb44e18691ba954e40)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| [Errors](#classtensorflow_1_1ops_1_1_unicode_transcode_1a4ec0643c5c92c98679d67690e8d6826c)`(StringPiece x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/unicode-transcode/attrs#structtensorflow_1_1ops_1_1_unicode_transcode_1_1_attrs) |\n| [ReplaceControlCharacters](#classtensorflow_1_1ops_1_1_unicode_transcode_1ac2031f1a1d602c2981d079a72e41ad8b)`(bool x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/unicode-transcode/attrs#structtensorflow_1_1ops_1_1_unicode_transcode_1_1_attrs) |\n| [ReplacementChar](#classtensorflow_1_1ops_1_1_unicode_transcode_1a006b666456f90b0903bcaea23ee678cd)`(int64 x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/unicode-transcode/attrs#structtensorflow_1_1ops_1_1_unicode_transcode_1_1_attrs) |\n\n| ### Structs ||\n|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::UnicodeTranscode::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/unicode-transcode/attrs) | Optional attribute setters for [UnicodeTranscode](/versions/r1.15/api_docs/cc/class/tensorflow/ops/unicode-transcode#classtensorflow_1_1ops_1_1_unicode_transcode). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### UnicodeTranscode\n\n```gdscript\n UnicodeTranscode(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n StringPiece input_encoding,\n StringPiece output_encoding\n)\n``` \n\n### UnicodeTranscode\n\n```gdscript\n UnicodeTranscode(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n StringPiece input_encoding,\n StringPiece output_encoding,\n const UnicodeTranscode::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### Errors\n\n```text\nAttrs Errors(\n StringPiece x\n)\n``` \n\n### ReplaceControlCharacters\n\n```text\nAttrs ReplaceControlCharacters(\n bool x\n)\n``` \n\n### ReplacementChar\n\n```text\nAttrs ReplacementChar(\n int64 x\n)\n```"]]