<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_spell_check_part_attributes</TITLE><H1>%mqc_spell_check_part_attributes </H1><P CLASS="Paragraph">Classname: <B>%mqc_spell_check_part_attributes </B></P><P CLASS="Paragraph">Inherits from: <B><A href=..\checkmate\xug_base_checker.html>%ug_base_checker </A></B></P><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"> </PRE><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">
<B>Description:</B>
    Spell check the text in part attributes of a part file
    This checker will list all part attribute words not in the default MS Word dictionary
    and/or custom dictionary. If show_tips is set to true, this checker will list the
    suggestion words too.
    This checker does not support the languages with multi-byte characters set (MBCS).
    Such as Chinese, Japanese, Korean and some of German words (umlauts).
    The implementation of this checker is based on the Microsoft Word spelling check COM
    interface.
    Hence, it ONLY runs on the Windows platform and requires MS Word to be installed
    properly.
    Reference: mqc_spell_check_annotations.dfa
    Note: Part attribute spell check has different logging mechanisms from Annotation spell
    check.
    This is because annotation entities are displayable entities on the Graphics window,
    while part attributes are not.
Parameters:
    ( Boolean )  disabled?  -  If it is true, the checker is disabled.
                               Default is False.
    ( Boolean )  save_log_in_part
                               The flag indicates whether the checking results
                               can be saved to the part file.
                               Default is True.
    ( Boolean )  show_part_attribute_text
                               Whether or not to show the text of the detected
                               part attributes.
                               Default is False.
    ( Boolean )  show_words -  Whether or not to show the words in question.
                               Default is False.
    ( Boolean )  show_tips  -  Whether or not to show spelling tips if show_words is set to
                               true.
                               Default is False.
    ( Boolean )  ignoreUppercase                              Ignore words in UPPERCASE or not
                              Default is False
    ( Boolean )  ignoreMixedDigits                              Ignore words with numbers or not
                              Default is False
    ( Boolean )  ignoreInternetAndFileAddresses                              Ignore Internet and file addresses or not
                              Default is False
    ( String )   custom_dictionary                              The custom dictionary contains the words to be ignored in
                              spelling check.
                              It is one word per line in the file.
                              For example, if 'prt' is to be ignored,
                              and is defined in a dictionary file,
                              all 'prt' found in the objects will be ignored.
    ( Boolean )  use_custom_dictionary_only                              Indicates whether or not to use custom dictionary exclusively.
                              True  - Only use the custom dictionary, and
                                      Ignore the default MS word dictionaries.
                              False - Use the custom dictionary plus the MS word
                                      dictionary when performing spell check.
                              Default is True.
    ( Name )     log_type   - Indicate which logging type to use to report
                              the violation.
                                  LOG_ERROR
                                  LOG_WARNING
                                  LOG_INFO
                              Default is LOG_ERROR
    ( String )   log_msg    - User defined message to be added when the system
                              reports the violation.
                              Default is an empty string.
Results:
    FAILED  - Any word in part attributes is not found in the dictionary.
    PASS    - All the words in the part attributes are found in the dictionary.
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_spell_check_part_attributes( %ug_base_checker );
</FONT></PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )    %test_category:  "Spell Check";
   ( String )    %displayed_name: "Spell Check on Part Attributes";
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( Boolean Parameter )    disabled?: false;
   ( Boolean Parameter )    save_log_in_part: true;
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">   Attributes for this class</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             show_part_attribute_text_label: "Show Unmatched Part Attributes";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             show_words_label: "Show Unmatched Words";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             show_tips_label: "Show Spelling Tips";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             ignoreUppercase_label: "Ignore words in UPPERCASE";
   
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             ignoreMixedDigits_label: "Ignore words with numbers";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             ignoreInternetAndFileAddresses_label: "Ignore Internet and file addresses";
   
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             use_custom_dictionary_only_label: "Check with Custom Dictionary Only";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             custom_dictionary_label: "Custom Dictionary";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             log_type_label: "Log Option";
   ( List )               log_type_option: { LOG_ERROR, LOG_WARNING, LOG_INFO };

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( Boolean Parameter )  show_part_attribute_text:       False;
   ( Boolean Parameter )  show_words: False;
   ( Boolean Parameter )  show_tips: False;
   ( Boolean Parameter )  ignoreUppercase: False;
   ( Boolean Parameter )  ignoreMixedDigits: False;
   ( Boolean Parameter )  ignoreInternetAndFileAddresses: False;
   ( Boolean Parameter )  use_custom_dictionary_only: True;
   ( String Parameter )   custom_dictionary: "";
   ( Name Parameter )     log_type: LOG_ERROR;
   ( String Parameter )   log_msg: "";
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )             log_msg_label: "User Defined Message";
   
   ( Any Uncached ) do_check:

   @{
   
       $part_attrs << mqc_askPartAttributeInfo();
   
       If ( Empty?( $part_attrs ) )
       Then donothing
       Else 
       @{
            $attr_titles << First ( $part_attrs );
            $attr_values << Second( $part_attrs );
            
            # use Microsoft Word spelling check to test all words' spelling.
            $spell_result << mqc_checkSentencesSpelling($attr_values,
                                 needTips?, show_tips:,
                                 user_dictionary,custom_dictionary:,
                                 specified_dic_only?, use_custom_dictionary_only:,
                                 ignoreUppercase?,ignoreUppercase:,
                                 ignoreMixedDigits?,ignoreMixedDigits:,
                                 ignoreInternetAndFileAddresses?,ignoreInternetAndFileAddresses:);

            $error_messages << Loop
            {
                For  $attr_title  In  $attr_titles;
                For  $attr_value  In  $attr_values;
                For  $each_result In  $spell_result;

                For  $error_strs  Is  mqc_make_error_words_list:( $each_result );

                If  ( -Empty?( $each_result ) )
                Append { @{"  Part Attribute ~""+$attr_title+
                           "~" has unmatched words.";}+
                         @{If (show_part_attribute_text:)
                           Then "~n   Its value is ~""+$attr_value+"~"."
                           Else "";}+
                         @{If (show_words:) 
                           Then "~n   Questionable words are:~n     "+
                                mqc_list_to_string($error_strs,"~n    ")+"~n"
                           Else "";} };
            };

            If ( Empty?( $error_messages ) )
            Then donothing
            Else
            @{
                 $log_message << @{If (log_msg:="") Then "" Else log_msg:+"~n";}+
                                 @{"Found "+Stringvalue(Length($error_messages))+
                                   " part attributes with unmatched words.";}+
                                 @{"~n~n "+mqc_list_to_string($error_messages,"~n");};
      
                 ug_mqc_log( log_type:, {}, $log_message );
            };
       };
   };

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( Method List ) mqc_make_error_words_list:( List  $words_list )
   @{
         Loop
         {
              For  $each_item  In  $words_list;
              For  $typo_word  Is  First( $each_item );
              For  $tips_list  Is  Sublist( $each_item, 2, Length( $each_item ) );

              If ( $typo_word != NoValue )
              Append { $typo_word+
                       @{ If ((show_tips:) & (-Empty?($tips_list)))
                          Then "~t- "+mqc_list_to_string($tips_list,", ")+"."
                          Else If (show_tips:)
                          Then "~t- No tips."
                          Else "";} };
         };
   };
   

   </SPAN></FONT></PRE></DIV></TABLE><p class=EndLine>&nbsp;</p><p class=blank>&nbsp;</p></BODY></HTML>