Skip to content

Commit c50c738

Browse files
jsimonwebbusunkim96leahecole
authored
Remove Language sample unused region_tag comments (#3078)
Co-authored-by: Bu Sun Kim <[email protected]> Co-authored-by: Leah E. Cole <[email protected]>
1 parent b573312 commit c50c738

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

language/classify_text/classify_text_tutorial.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# [START language_classify_text_tutorial]
1716
"""Using the classify_text method to find content categories of text files,
1817
Then use the content category labels to compare text similarity.
1918
@@ -94,7 +93,6 @@ def index(path, index_file):
9493
# [END language_classify_text_tutorial_index]
9594

9695

97-
# [START language_classify_text_tutorial_split_labels]
9896
def split_labels(categories):
9997
"""The category labels are of the form "/a/b/c" up to three levels,
10098
for example "/Computers & Electronics/Software", and these labels
@@ -121,10 +119,8 @@ def split_labels(categories):
121119
_categories[label] = confidence
122120

123121
return _categories
124-
# [END language_classify_text_tutorial_split_labels]
125122

126123

127-
# [START language_classify_text_tutorial_similarity]
128124
def similarity(categories1, categories2):
129125
"""Cosine similarity of the categories treated as sparse vectors."""
130126
categories1 = split_labels(categories1)
@@ -143,7 +139,6 @@ def similarity(categories1, categories2):
143139
dot += confidence * categories2.get(label, 0.0)
144140

145141
return dot / (norm1 * norm2)
146-
# [END language_classify_text_tutorial_similarity]
147142

148143

149144
# [START language_classify_text_tutorial_query]
@@ -255,4 +250,3 @@ def query_category(index_file, category_string, n_top=3):
255250
query(args.index_file, args.text)
256251
if args.command == 'query-category':
257252
query_category(args.index_file, args.category)
258-
# [END language_classify_text_tutorial]

0 commit comments

Comments
 (0)