Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // your Spin Rewriter email address goes here
            var email_address = "*****@*****.**";

            // your unique Spin Rewriter API key goes here
            var api_key = "1ab234c#d5e67fg_h8ijklm?901n234";

            // Authenticate yourself.
            var spinrewriter_api = new SpinRewriterAPI(email_address, api_key);

            // The return value is a JsonValue array type object or null on error
            var response = spinrewriter_api.getQuota();

            if (response != null)
            {
                Console.WriteLine(response.ToString());

                // To access individual response values access them
                // like an array entries (declare its type at the front,
                // because JSON can return different types strings, bools etc.)
                //
                // if (response.ContainsKey("status"))
                // {
                //    string status = response["status"];
                //    Console.WriteLine((string)response["status"]);
                // }
                //
                // etc.
            }
            else
            {
                Console.WriteLine("Spin Rewriter API error");
            }

            Console.WriteLine("\nPress any key to quit...");
            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // your Spin Rewriter email address goes here
            var email_address = "*****@*****.**";

            // your unique Spin Rewriter API key goes here
            var api_key = "1ab234c#d5e67fg_h8ijklm?901n234";

            // Authenticate yourself.
            var spinrewriter_api = new SpinRewriterAPI(email_address, api_key);

            /*
             * (optional) Set a list of protected terms.
             * You can use one of the following formats:
             * - protected terms are separated by the '\n' (newline) character
             * - protected terms are separated by commas (comma-separated list)
             * - protected terms are stored in a string[] array
             */
            var protected_terms = "John, Douglas Adams, then";

            //var protected_terms = "John\nDouglas\nAdams\nthen";
            //string[] protected_terms =  { "John", "Douglas", "Adams", "then" };

            // (optional) Set whether the One-Click Rewrite process automatically protects Capitalized Words outside the article's title.
            spinrewriter_api.setAutoProtectedTerms(false);

            // (optional) Set the confidence level of the One-Click Rewrite process.
            spinrewriter_api.setConfidenceLevel(ConfidenceLevels.Medium);

            // (optional) Set whether the One-Click Rewrite process uses nested spinning syntax (multi-level spinning) or not.
            spinrewriter_api.setNestedSpintax(true);

            // (optional) Set whether Spin Rewriter rewrites complete sentences on its own.
            spinrewriter_api.setAutoSentences(false);

            // (optional) Set whether Spin Rewriter rewrites entire paragraphs on its own.
            spinrewriter_api.setAutoParagraphs(false);

            // (optional) Set whether Spin Rewriter writes additional paragraphs on its own.
            spinrewriter_api.setAutoNewParagraphs(false);

            // (optional) Set whether Spin Rewriter changes the entire structure of phrases and sentences.
            spinrewriter_api.setAutoSentenceTrees(false);

            // (optional) Sets whether Spin Rewriter should only use synonyms (where available) when generating spun text.
            spinrewriter_api.setUseOnlySynonyms(false);

            // (optional) Sets whether Spin Rewriter should intelligently randomize the order of paragraphs and lists when generating spun text.
            spinrewriter_api.setReorderParagraphs(false);

            // (optional) Sets whether Spin Rewriter should automatically enrich generated articles with headings, bullet points, etc.
            spinrewriter_api.setAddHTMLMarkup(false);

            // (optional) Sets whether Spin Rewriter should automatically convert line-breaks to HTML tags.
            spinrewriter_api.setUseHTMLLinebreaks(false);

            // Make the actual API request and save the response as a native JSON object.
            var text = "John will book a room. Then he will read a book by Douglas Adams.";

            // The return value is a JsonValue array type object or null on error
            var response = spinrewriter_api.getUniqueVariation(text);

            if (response != null)
            {
                Console.WriteLine(response.ToString());

                // To access individual response values access them
                // like an array entries (declare its type at the front,
                // because JSON can return different types strings, bools etc.)
                //
                // if (response.ContainsKey("status"))
                // {
                //    string status = response["status"];
                //    Console.WriteLine((string)response["status"]);
                // }
                //
                // etc.
            }
            else
            {
                Console.WriteLine("Spin Rewriter API error");
            }

            Console.WriteLine("\nPress any key to quit...");
            Console.ReadKey();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            // your Spin Rewriter email address goes here
            var email_address = "*****@*****.**";

            // your unique Spin Rewriter API key goes here
            var api_key = "1ab234c#d5e67fg_h8ijklm?901n234";

            // Authenticate yourself.
            var spinrewriter_api = new SpinRewriterAPI(email_address, api_key);

            // (optional) Sets whether Spin Rewriter should only use synonyms (where available) when generating spun text.
            spinrewriter_api.setUseOnlySynonyms(false);

            // (optional) Sets whether Spin Rewriter should intelligently randomize the order of paragraphs and lists when generating spun text.
            spinrewriter_api.setReorderParagraphs(false);

            // (optional) Sets whether Spin Rewriter should automatically enrich generated articles with headings, bullet points, etc.
            spinrewriter_api.setAddHTMLMarkup(false);

            // (optional) Sets whether Spin Rewriter should automatically convert line-breaks to HTML tags.
            spinrewriter_api.setUseHTMLLinebreaks(false);

            /*
             * IMPORTANT:
             *
             * When using the action 'unique_variation_from_spintax', your text
             * should already contain valid {first option|second option} spinning syntax.
             *
             * No additional processing is done on your text, Spin Rewriter simply
             * provides one of the unique variations of the given (already spun) text.
             */
            var text = "John {will|will certainly} {book|make a reservation for} a {room|hotel suite}.";

            // The return value is a JsonValue array type object or null on error
            var response = spinrewriter_api.getUniqueVariationFromSpintax(text);

            if (response != null)
            {
                Console.WriteLine(response.ToString());

                // To access individual response values access them
                // like an array entries (declare its type at the front,
                // because JSON can return different types strings, bools etc.)
                //
                // if (response.ContainsKey("status"))
                // {
                //    string status = response["status"];
                //    Console.WriteLine((string)response["status"]);
                // }
                //
                // etc.
            }
            else
            {
                Console.WriteLine("Spin Rewriter API error");
            }

            Console.WriteLine("\nPress any key to quit...");
            Console.ReadKey();
        }